diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index 914cccc..a6478e8 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -34,7 +34,7 @@ namespace TradeManageNew { public class DataNew { - public static List AmazonGroupPeoples = new List() { 60, 69, 182, 190, 200, 213, 216, 221, 204, 205, 206, 207, 208, 209, 210, 212, 215, 222, 229, 230, 231, 232, 233, 234, 235,236 };//个人销售数据页面需要显示的亚马逊销售人员 + public static List AmazonGroupPeoples = new List() { 60, 69, 182, 190, 200, 213, 216, 221, 204, 205, 206, 207, 208, 209, 210, 212, 215, 222, 229, 230, 231, 232, 233, 234, 235, 236 };//个人销售数据页面需要显示的亚马逊销售人员 #region 查询我得店铺 public static List GetMyShop(string Name, int UserId) { @@ -1762,7 +1762,7 @@ where OrderId=@OrderId"; } #endregion #region 统计总金额扣除佣金 - public static List GetCountListReport(int Type,int platid, int ShopId, DateTime? SDate, DateTime? EDate, int CompanyId) + public static List GetCountListReport(int Type, int platid, int ShopId, DateTime? SDate, DateTime? EDate, int CompanyId) { string tsql = ""; List list = null; @@ -1798,7 +1798,7 @@ where OrderId=@OrderId"; } #endregion #region 统计总金额扣除佣金 - public static List GetCountListReportNew(int Type, int platid,int ShopId, string ShopIds, DateTime? SDate, DateTime? EDate, int CompanyId) + public static List GetCountListReportNew(int Type, int platid, int ShopId, string ShopIds, DateTime? SDate, DateTime? EDate, int CompanyId) { string tsql = ""; List list = null; @@ -2548,7 +2548,7 @@ update b set b.Fee11=a.fee6 from DT_OrderInfo a } #endregion #region 分页查询 - public static List GetListHW_GoodsDetailNew22(int platid,int StoreId, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) + public static List GetListHW_GoodsDetailNew22(int platid, int StoreId, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) { if (where == null) @@ -2557,7 +2557,7 @@ update b set b.Fee11=a.fee6 from DT_OrderInfo a } QueryService service = new QueryService { - + Fields = "DetailId=cast(a.DetailId as int),a.GoodsId,a.TypeCode,a.TypeDesc,a.SKU1,a.SKU2,a.SKU3,a.SKU4,a.SKU5,a.Weight,GoodsNum=isnull(a.GoodsNum,0),a.GoodsLockNum,a.GoodsPlanNum,a.GoodsOutNum,a.GoodsInNum,GoodsInNum3=isnull(a.GoodsInNum,0)-isnull(a.BHNum3,0),GoodsInNum2=isnull(a.GoodsInNum2,0),GoodsHJNum=isnull(a.GoodsHJNum,0),GoodsHJNum2=isnull(a.GoodsHJNum2,0),GoodsHJNum3=isnull(a.GoodsHJNum3,0),a.GoodsHJNum4,a.Price,a.GoodsImageIds,FirstImgUrl=case when a.FirstImgUrl is null or a.FirstImgUrl='' then b.FirstImgUrl else a.FirstImgUrl end,a.UpdateDate,a.UpdateName,a.GoodsRemark,a.SaleDays,a.AvgTime,a.SafeNum,b.Solid,a.BGPrice,a.SKU6,a.SKU7,a.SKU8,a.SKU9,a.SKU10,b.GoodsCode,b.GoodsName,b.SupplierId,LeftNum=isnull(a.GoodsNum,0)+isnull(a.GoodsInNum,0)+isnull(a.GoodsInNum2,0)-isnull(a.GoodsPlanNum,0),LeftNumW=isnull(a.WestNum,0)+isnull(a.GoodsHJNum14,0)-isnull(a.GoodsPlanNumW,0),LeftNumE=isnull(a.EastNum,0)+isnull(a.GoodsHJNum15,0)-isnull(a.GoodsPlanNumE,0),b.Cert,b.JYPrice,OutNum=isnull(a.GoodsBackNum,0),SJOutNum=isnull(a.GoodsBackNum2,0),MinBuyNum=isnull(a.GoodsBackNum3,0),AutoPlan=DATEDIFF(day,b.LastOrderDate,GETDATE()),NoGoods=isnull(b.IsSure,0),YCState=case when a.IsYC=1 then '显示SKU' else '隐藏SKU' end,CGNum=case when FHPlan=3 then isnull(CGNum,0) when FHPlan=1 then isnull(CGNum2,0) when FHPlan=2 then isnull(CGNum3,0) else isnull(CGNum,0) end,GoodsBackNum4=isnull(a.GoodsBackNum4,0),GoodsBackNum5=isnull(a.GoodsBackNum5,0),GoodsBackNum6=isnull(a.GoodsBackNum6,0),GoodsHJNum5=isnull(a.GoodsHJNum5,0),GoodsHJNum6=isnull(a.GoodsHJNum6,0),GoodsHJNum7=isnull(a.GoodsHJNum7,0),GoodsHJNum8=isnull(a.GoodsHJNum8,0),GoodsHJNum9=isnull(a.GoodsHJNum9,0),GoodsHJNum10=isnull(a.GoodsHJNum10,0),GoodsHJNum11=isnull(a.GoodsHJNum11,0),WestNum=isnull(a.WestNum,0),EastNum=isnull(a.EastNum,0),GoodsHJNum12=isnull(a.GoodsHJNum12,0),GoodsHJNum13=isnull(a.GoodsHJNum13,0),GoodsHJNum14=isnull(a.GoodsHJNum14,0),GoodsHJNum15=isnull(a.GoodsHJNum15,0),JHDays=isnull(b.JHDays,0),FHPlan=isnull(FHPlan,0),CGNum2=isnull(CGNum2,0),CGNum3=isnull(CGNum3,0),bhremark,a.BHNum1,a.BHNum2,a.BHNum3,a.JH_Date,IsSP=isnull(a.IsSP,0),SalesType=isnull(SalesType,-1),b.MName,d.groupname,b.IsExamine,GoodsHJNum_FBA=isnull(a.GoodsHJNum_FBA,0),b.SubsidyFee,e.YuGuJiaGe,a.TemuPrice,a.ManuaPrice " }; if (platid == 3) @@ -4142,7 +4142,7 @@ update HW_GoodsUser set grade=@grade where id=@id } #endregion #region - public static void UpdateGoodsUser(int shopid,string name, int userid) + public static void UpdateGoodsUser(int shopid, string name, int userid) { string tsql = @" update a set a.UserId=@userid from HW_GoodsUser a @@ -4161,7 +4161,7 @@ where b.Name=@name and (@shopid=0 or shopid=@shopid) #region public static void EditGoodsUser() { - + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("UpdateGoodsUser"); db.ExecuteNonQuery(cmd); @@ -4867,11 +4867,11 @@ where a.OrderId=@OrderId"; return a; } - public static decimal GetOutFeeType(int CompanyId,int FeeType) + public static decimal GetOutFeeType(int CompanyId, int FeeType) { string tsql = @"select Fee=SUM(fee2) from DT_OrderInfo where CompanyId=@CompanyId and State>0 and State<3"; - if (FeeType==7) - tsql = @"select Fee=SUM(fee1) from DT_OrderInfo where CompanyId=@CompanyId and State>0 and State<3"; + if (FeeType == 7) + tsql = @"select Fee=SUM(fee1) from DT_OrderInfo where CompanyId=@CompanyId and State>0 and State<3"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@CompanyId", DbType.Int32, CompanyId); @@ -4889,7 +4889,7 @@ select @Num=count(0) from DT_OrderInfo where CompanyId=@CompanyId and State>0 select @Num2=count(0) from DT_OrderInfo where CompanyId=@CompanyId and State>0 and State<3 and isnull(fee2,0)=0 select Num2=@Num2,Num=@Num "; - + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@CompanyId", DbType.Int32, CompanyId); @@ -6265,7 +6265,7 @@ update HW_GoodsDetail set BHNum1=null,BHNum2=null,JH_Date=null where isnull(BH string tsql = @"select SKU1,b.Solid,BHNum=a.BHNum1,TSolid=isnull(b.Solid,0)*a.BHNum1,Cert='',a.JH_Date from HW_GoodsDetail a inner join HW_GoodsInfo b on a.GoodsId = b.GoodsId where BHNum1> 0"; - if(CK==1) + if (CK == 1) tsql = @"select SKU1,b.Solid,BHNum=a.BHNum2,TSolid=isnull(b.Solid,0)*a.BHNum2,Cert='',a.JH_Date from HW_GoodsDetail a inner join HW_GoodsInfo b on a.GoodsId = b.GoodsId where BHNum2> 0"; @@ -6291,7 +6291,7 @@ select BHNum1,BHNum2 from HW_GoodsDetail where detailid=@DetailId if (tb != null) { if (tb.Tables.Count > 0 && tb.Tables[0].Rows.Count > 0) model = tb.Tables[0].Rows[0].ToModel(); - + } @@ -7138,27 +7138,32 @@ end #region 智能库存temu筛选 - public static List GetTemuSKUData(int PageSize,int PageIndex,string GoodsCode, out int rowCount) + public static List GetTemuSKUData(int PageSize, int PageIndex, string GoodsCode, out int rowCount) { List model = null; string sqlPage = string.Empty; string where = string.Empty; - if (PageSize > 1) - { - sqlPage = " and row between " + ((PageIndex - 1) * PageSize + 1) + " and " + PageIndex * PageSize; - } - else + + if (PageSize < 10000) { - sqlPage = " and row between 1 and " + PageIndex * PageSize; + if (PageIndex > 1) + { + + sqlPage = " and row between " + ((PageIndex - 1) * PageSize + 1) + " and " + PageIndex * PageSize; + } + else + { + sqlPage = " and row between 1 and " + PageIndex * PageSize; + } } if (!string.IsNullOrEmpty(GoodsCode)) { - where = " and GoodsCode='" + GoodsCode+"' "; + where = " and GoodsCode='" + GoodsCode + "' "; } //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 + + 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 + -@"select GoodsId,GoodsCode,Name,temuChengben,JYPrice,GrossProfit,SaleNum1,SaleNum2,SaleNum3,SaleNum7,SaleNum14,SaleNum30,GoodsHJNum,LeftNumW,LeftNumE, PositionAge,LeftNumAll from ( + @"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 from [dbo].[TemuChengBen] a inner join HW_GoodsInfo b on a.GoodsId=b.GoodsId @@ -7233,10 +7238,10 @@ 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 " + sqlPage + where+ " order by GoodsHJNum desc "; +where 1=1 " + sqlPage + where + " order by GoodsHJNum desc "; 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) @@ -7390,7 +7395,7 @@ end #region 返回扫描订单Model - public static DT_OrderScanModel GetScanOrderModelForReturn(string OrderCode, string OrderCode2,int UserId) + public static DT_OrderScanModel GetScanOrderModelForReturn(string OrderCode, string OrderCode2, int UserId) { DT_OrderScanModel model = null; string tsql = @" @@ -7578,7 +7583,7 @@ where b.PostionCode='" + Name + "' or b.PostionDesc='" + Name + "'))a"; #region 获取导出的出库记录 - public static List GetImportHW_GoodsOutList(int TJ,string CKYY,string Name,DateTime? sdate,DateTime? edate) + public static List GetImportHW_GoodsOutList(int TJ, string CKYY, string Name, DateTime? sdate, DateTime? edate) { var filt = " where a.IsDelete=0 "; switch (TJ) @@ -7603,7 +7608,7 @@ where b.PostionCode='" + Name + "' or b.PostionDesc='" + Name + "'))a"; break; } - if(!string.IsNullOrEmpty(CKYY)) + if (!string.IsNullOrEmpty(CKYY)) { filt += " and a.OutReason in (" + CKYY.TrimEnd(',') + ")"; } @@ -10545,7 +10550,7 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b #region 返回temu费用 public static List GetOrdertemuFee(int OrderId) { - + string tsql = @"select * from TemuOrderPostFee where OrderId=@OrderId"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); @@ -11011,14 +11016,14 @@ where a.OrderId in (" + OrderIds + ")"; #region 返回列表 public static int DeletelPostFee(int GoodsId) { - + string tsql = @" delete from HW_PostFee where GoodsId=@GoodsId"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@GoodsId", DbType.Int32, GoodsId); - db.ExecuteNonQuery(cmd); - + db.ExecuteNonQuery(cmd); + return 1; } #endregion @@ -11779,7 +11784,7 @@ update DT_OrderInfoNew set PostState=@PostState where OrderId=@OrderId"; #region 分页查询 - public static List GetListDT_OrderInfoForTM2_New(int CompanyId, string MName, string GoodsName, string SKU, string TrackCode, int IsSku, int IsDH, RefParameterCollection where, int PageIndex, int PageSize, string Sort,out int RowCount,string groupName="") + public static List GetListDT_OrderInfoForTM2_New(int CompanyId, string MName, string GoodsName, string SKU, string TrackCode, int IsSku, int IsDH, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount, string groupName = "") { string sql1 = ""; string NoGoodsSql = ""; @@ -11836,7 +11841,7 @@ select distinct OrderId into #OrderTemp from (select a.OrderId from DT_Order where b.CompanyId=@CompanyId and a.GoodsSku like '%" + SKU + "%'"; - if (sql1 == "" && ((IsDH > -1) || MName != "" || groupName!="")) + if (sql1 == "" && ((IsDH > -1) || MName != "" || groupName != "")) { sql1 = @"select distinct z.OrderId into #OrderTemp from ( select b.OrderId,b.muserid,u.Name as MName, u.GroupName from ( @@ -11882,7 +11887,7 @@ a.OrderState,c.ShopName,c.Country,StateName=case when a.State=1 and PostState=0 #endregion #region 分页查询 - public static List GetListDT_OrderInfoForTM2(int CompanyId, string MName,string GoodsName, string SKU, string TrackCode, int IsSku, int IsDH, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) + public static List GetListDT_OrderInfoForTM2(int CompanyId, string MName, string GoodsName, string SKU, string TrackCode, int IsSku, int IsDH, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) { string sql1 = ""; string NoGoodsSql = ""; @@ -11890,8 +11895,8 @@ a.OrderState,c.ShopName,c.Country,StateName=case when a.State=1 and PostState=0 NoGoodsSql = " and isnull(b.NoGoods,0)=1"; if (IsDH == 0) NoGoodsSql = " and isnull(b.NoGoods,0)=0"; - if(MName!="") - NoGoodsSql += " and isnull(c.MName,'')='" + MName +"'"; + if (MName != "") + NoGoodsSql += " and isnull(c.MName,'')='" + MName + "'"; if (TrackCode != "") { sql1 = @"select OrderId into #OrderTemp from DT_TrackCodeApply with (nolock) @@ -11939,7 +11944,7 @@ select distinct OrderId into #OrderTemp from (select a.OrderId from DT_Order where b.CompanyId=@CompanyId and a.GoodsSku like '%" + SKU + "%'"; - if (sql1 == "" && ((IsDH > -1)||MName!="")) + if (sql1 == "" && ((IsDH > -1) || MName != "")) sql1 = @"select distinct a.OrderId into #OrderTemp from DT_OrderGoods a with (nolock) inner join HW_GoodsDetail b with (nolock) on a.DetailId=b.DetailId inner join HW_GoodsInfo c with (nolock) on b.GoodsId=c.GoodsId @@ -11972,7 +11977,7 @@ a.OrderState,c.ShopName,c.Country,StateName=case when a.State=1 and PostState=0 return ListModel; } #endregion - + #region 分页查询 public static List GetListDT_OrderInfoForTM222(int CompanyId, string GoodsName, string KTSKU, string SKU, string TrackCode, int IsSku, int IsDH, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) { @@ -13186,7 +13191,7 @@ left join hw_goodsextra b with(nolock) on a.GoodsId=b.goodsid"; } #endregion #region 分页动态条件查询 - public static List GetListGoodsPlan(int platid,string name, int IsFP, int IsLJ, string where, int cdtj,int iskc,int shopId, int PageIndex, int PageSize, string Sort, out int RowCount) + public static List GetListGoodsPlan(int platid, string name, int IsFP, int IsLJ, string where, int cdtj, int iskc, int shopId, int PageIndex, int PageSize, string Sort, out int RowCount) { QueryService2 ser = new QueryService2(); @@ -13242,7 +13247,7 @@ from HW_GoodsDetail a where goodsid in (select goodsid from #ls2) group by Good { sql2 += @" select distinct GoodsId into #ls4 from HW_BuyLink a inner join JC_Shop b on a.LinkDesc=b.ShopName where ShopId=" + shopId + " "; } - else if(iskc==1) + else if (iskc == 1) { sql2 += @" select distinct GoodsId into #ls4 from HW_BuyLink a inner join JC_Shop b on a.LinkDesc=b.ShopName where a.GoodsId in (select goodsid from #ls3) and ShopId=" + shopId + " "; } @@ -13314,8 +13319,8 @@ where b.State=1 and b.Name like '%" + name + @"%')"; tj += " and goodsid in (select GoodsId from " + tableName + ") "; } - if(platid==2) - ser.Tsql = @"select id=cast(a.GoodsId as int),a.goodscode,imgurl=a.FirstImgUrl,a.Solid,JDDate=isnull(b.JDDate,a.InDate),b.PZDate,b.SJDate,b.RKDate,b.YPDate,b.BuyName,b.TPDate,b.Date1,b.Date2,IsEnd=isnull(a.IsEnd,0),EndName=case when isend=1 then '恢复' else '结束' end,a.muserid,a.mname,a.Leaveword,a.Leaveword_cg,a.GoodsHJNum2,a.GoodsHJNum3,a.GoodsHJNum4,a.GoodsMonthHJPrice,a.GoodsWeekHJNum,a.GoodsWeekHJPrice,NoOutDays=Case when DATEDIFF(day,IsNull(a.LastOrderDate,GETDATE()),GETDATE())<=0 then 0 else DATEDIFF(day,IsNull(a.LastOrderDate,GETDATE()),GETDATE()) end ,c.OutDays2, Convert(decimal(12,2), IsNull(a.JYPrice,0)*(1-0.05)) Price,Convert(decimal(12,2), IsNull(a.JYPrice,0)*(1+0.05)) Price2,c.Price3,c.Price4,c.Price5,c.Price6,c.Price7,c.Price8,c.Num,c.Num2,c.Num3,c.Num4,c.Num5,c.Num6,c.Num7,c.ShopNames,c.PlanInfo,c.AdviseInfo,c.Remark,a.PlanCount ,a.EditPlanCount from HW_GoodsInfo a with(nolock) + if (platid == 2) + ser.Tsql = @"select id=cast(a.GoodsId as int),a.goodscode,imgurl=a.FirstImgUrl,a.Solid,JDDate=isnull(b.JDDate,a.InDate),b.PZDate,b.SJDate,b.RKDate,b.YPDate,b.BuyName,b.TPDate,b.Date1,b.Date2,IsEnd=isnull(a.IsEnd,0),EndName=case when isend=1 then '恢复' else '结束' end,a.muserid,a.mname,a.Leaveword,a.Leaveword_cg,a.GoodsHJNum2,a.GoodsHJNum3,a.GoodsHJNum4,a.GoodsMonthHJPrice,a.GoodsWeekHJNum,a.GoodsWeekHJPrice,NoOutDays=Case when DATEDIFF(day,IsNull(a.LastOrderDate,GETDATE()),GETDATE())<=0 then 0 else DATEDIFF(day,IsNull(a.LastOrderDate,GETDATE()),GETDATE()) end ,c.OutDays2, Convert(decimal(12,2), IsNull(a.JYPrice,0)*(1-0.05)) Price,Convert(decimal(12,2), IsNull(a.JYPrice,0)*(1+0.05)) Price2,c.Price3,c.Price4,c.Price5,c.Price6,c.Price7,c.Price8,c.Num,c.Num2,c.Num3,c.Num4,c.Num5,c.Num6,c.Num7,c.ShopNames,c.PlanInfo,c.AdviseInfo,c.Remark,a.PlanCount ,a.EditPlanCount from HW_GoodsInfo a with(nolock) left join hw_goodsextra b with(nolock) on a.GoodsId=b.goodsid left join HW_GoodsUserPlanCount c with(nolock) on a.GoodsId = c.GoodsId"; else if (platid == 3) @@ -13418,13 +13423,13 @@ where b.State=1 and GoodsId in (" + mids + ") order by a.GoodsId,c.PlatType,a.sh #endregion #region 返回列表 - public static List GetListGoodsPlanDetail2(string mids,int platid) + public static List GetListGoodsPlanDetail2(string mids, int platid) { //string tsql = "select a.id,a.mid,a.sdate,a.edate,a.weekname,a.weeknum from HW_ProductionDetail"; -// string tsql = @" -//select ShopName=c.ShopName,a.GoodsId,url=a.LinkUrl,Name=c.Master,c.shopid from HW_BuyLink a with(nolock) -//inner join JC_Shop c with(nolock) on a.LinkDesc=c.ShopName -//where GoodsId in (" + mids + ") and c.plattype=@platid order by a.GoodsId,c.PlatType,c.shopid"; + // string tsql = @" + //select ShopName=c.ShopName,a.GoodsId,url=a.LinkUrl,Name=c.Master,c.shopid from HW_BuyLink a with(nolock) + //inner join JC_Shop c with(nolock) on a.LinkDesc=c.ShopName + //where GoodsId in (" + mids + ") and c.plattype=@platid order by a.GoodsId,c.PlatType,c.shopid"; //改为一个商品在一个店铺只取一条链接 string tsql = @"select ShopName=c.ShopName,a.GoodsId,url=a.LinkUrl,Name=c.Master,c.shopid from HW_BuyLink a inner join JC_Shop c on a.LinkDesc=c.ShopName where LinkId in (select MAX(LinkId) from HW_BuyLink a with(nolock) inner join JC_Shop c with(nolock) on a.LinkDesc=c.ShopName where GoodsId in (" + mids + ") and c.plattype=2 group by GoodsId,LinkDesc) "; @@ -14825,7 +14830,7 @@ select * from JC_Money foreach (var omd in ListModel3) { - + decimal tfee = 0; var glist = ListModel.FindAll(n => n.OrderId == omd.OrderId); if (glist == null) @@ -14851,7 +14856,7 @@ select * from JC_Money fmd = ListModel2.FindAll(n => n.ExpressId == md.Post && n.CountryCode == md.CountryCode); } - if (fmd != null&& fmd.Count>0) + if (fmd != null && fmd.Count > 0) { decimal MRate = 1; decimal MRate2 = 1; @@ -15025,7 +15030,7 @@ select * from JC_Money fmd = ListModel2.FindAll(n => n.ExpressId == md.Post && n.CountryCode == md.CountryCode); } - if (fmd != null&& fmd.Count>0) + if (fmd != null && fmd.Count > 0) { decimal MRate = 1; decimal MRate2 = 1; @@ -15041,14 +15046,14 @@ select * from JC_Money } foreach (var ffmd in fmd) { - - // ffmd.WeightType = 2; + + // ffmd.WeightType = 2; if (ffmd.WeightType == 1)//首重 { - - if (ffmd.FeeRate != null) - { + + if (ffmd.FeeRate != null) + { if (w < ffmd.EWeight.Value) { fee += ffmd.FeeRate.Value * w; @@ -15057,36 +15062,36 @@ select * from JC_Money { fee += ffmd.FeeRate.Value * ffmd.EWeight.Value; } - } - + } + if (ffmd.FeePrice != null) fee += ffmd.FeePrice.Value; if (ffmd.CodeFee != null) fee += ffmd.CodeFee.Value; w = w - ffmd.EWeight.Value; } - else if (ffmd.WeightType == 3&& ffmd.SWeight<=w&&w 0 && ffmd.WeightType == 2)//续重 { if ((w + ffmd.SWeight) <= ffmd.EWeight)//结束在这个范围 { - decimal ww =w; + decimal ww = w; //if (ffmd.offunit != null && ffmd.offunit > 0) //{ // if (w % ffmd.offunit == 0) @@ -15105,11 +15110,11 @@ select * from JC_Money fee += ffmd.CodeFee.Value; w = 0; } - else if(w>0) + else if (w > 0) { decimal ww = 0; - ww = ffmd.EWeight.Value - ffmd.SWeight.Value; - + ww = ffmd.EWeight.Value - ffmd.SWeight.Value; + if (ffmd.FeeRate != null) { fee += ffmd.FeeRate.Value * ww; @@ -15121,13 +15126,13 @@ select * from JC_Money w = w - ww; } } - + } fee = fee * MRate / MRate2;//转美金 } } - + tfee += fee; if (fee > 0) { @@ -15463,7 +15468,7 @@ select distinct a.GoodsId from HW_GoodsDetail a with(nolock) inner join HW_GoodsInfo b with(nolock) on a.GoodsId=b.GoodsId where b.CompanyId=@CompanyId and (@SKU='' or a.SKU1 like '%'+@SKU+'%' or a.SKU2 like '%'+@SKU+'%' or a.SKU3 like '%'+@SKU+'%' or a.SKU4 like '%'+@SKU+'%' or a.SKU5 like '%'+@SKU+'%' or a.SKU6 like '%'+@SKU+'%' or a.TypeCode like '%'+@SKU+'%' or a.TypeDesc like '%'+@SKU+'%' or b.GoodsName like '%'+@SKU+'%' or b.GoodsCode like '%'+@SKU+'%') and (@IsDH=0 or a.NoGoods=1) and (@IsSafe=0 or a.SafeNum>0) "; - + string[] templist = SKU.Split(' '); if (templist.Length > 1) { @@ -16368,7 +16373,7 @@ delete from [HW_GoodsOutDetail] where [OutId]=@OutId"; #endregion #region 保存货物出库明细 - public static int SaveGoodsOutDetailBuy(HW_GoodsOutCKNew Model,int state) + public static int SaveGoodsOutDetailBuy(HW_GoodsOutCKNew Model, int state) { string tsql = @" if @Id>0 @@ -16471,7 +16476,7 @@ select @OutId"; } #endregion #region 保存货物出库记录 - public static int UpdateGoodsOutBuyNM(int OutId, int state,string PayType) + public static int UpdateGoodsOutBuyNM(int OutId, int state, string PayType) { string tsql = @" Update [HW_GoodsOutList] set IsDelete=@state,PayType=@PayType where OutId=@OutId @@ -16544,7 +16549,7 @@ where b.PostionCode='" + Name + "' or b.PostionDesc='" + Name + "'))a"; return ListModel; } #endregion - + #region 返回出库明细 public static List GetOutCKDetailListForTM(int OutId) { @@ -16580,19 +16585,19 @@ where a.OutId=@OutId } #endregion - public static int iskc(int PostionId,int DetailId) + public static int iskc(int PostionId, int DetailId) { - + string tsql = " select KCNum=sum(KCNum) from HW_GoodsInDetail where OrderGoodsId=0 and PostionId=@PostionId and DetailId=@DetailId"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@DetailId", DbType.Int32, DetailId); db.AddInParameter(cmd, "@PostionId", DbType.Int32, PostionId); - int a =Convert.ToInt32(db.ExecuteScalar(cmd)); - + int a = Convert.ToInt32(db.ExecuteScalar(cmd)); + return a; - + } #region 返回出库明细 @@ -16640,30 +16645,30 @@ update DT_OrderReturn set tracking_id=@tracking_id where ordercode=@ordercode a end select @id"; Database db = DatabaseFactory.CreateDatabase(); - DbCommand cmd = db.GetSqlStringCommand(tsql); - db.AddInParameter(cmd,"@id", DbType.Int32,Model.id); - db.AddInParameter(cmd,"@orderid", DbType.Int32,Model.orderid); - db.AddInParameter(cmd,"@ordercode", DbType.String,Model.ordercode); - db.AddInParameter(cmd,"@asin", DbType.String,Model.asin); - db.AddInParameter(cmd,"@return_reason_code", DbType.String,Model.return_reason_code); - db.AddInParameter(cmd,"@merchant_sku", DbType.String,Model.merchant_sku); - db.AddInParameter(cmd,"@in_policy", DbType.String,Model.in_policy); - db.AddInParameter(cmd,"@return_quantity", DbType.Int32,Model.return_quantity); - db.AddInParameter(cmd,"@resolution", DbType.String,Model.resolution); - db.AddInParameter(cmd,"@refund_amount", DbType.Decimal,Model.refund_amount); - db.AddInParameter(cmd,"@tracking_id", DbType.String,Model.tracking_id); - db.AddInParameter(cmd,"@return_carrier", DbType.String,Model.return_carrier); - db.AddInParameter(cmd,"@label_cost", DbType.Decimal,Model.label_cost); - db.AddInParameter(cmd,"@order_date", DbType.DateTime,Model.order_date); - db.AddInParameter(cmd,"@return_request_date", DbType.DateTime,Model.return_request_date); - db.AddInParameter(cmd,"@return_request_status", DbType.String,Model.return_request_status); - db.AddInParameter(cmd,"@ScanDate", DbType.DateTime,Model.ScanDate); - db.AddInParameter(cmd,"@InType", DbType.String,Model.InType); - db.AddInParameter(cmd,"@ScanState", DbType.String,Model.ScanState); - db.AddInParameter(cmd,"@ScanUserId", DbType.Int32,Model.ScanUserId); - db.AddInParameter(cmd,"@remark", DbType.String,Model.remark); - db.AddInParameter(cmd,"@PostionCode", DbType.String,Model.PostionCode); - db.AddInParameter(cmd,"@detailid", DbType.Int32,Model.detailid); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@id", DbType.Int32, Model.id); + db.AddInParameter(cmd, "@orderid", DbType.Int32, Model.orderid); + db.AddInParameter(cmd, "@ordercode", DbType.String, Model.ordercode); + db.AddInParameter(cmd, "@asin", DbType.String, Model.asin); + db.AddInParameter(cmd, "@return_reason_code", DbType.String, Model.return_reason_code); + db.AddInParameter(cmd, "@merchant_sku", DbType.String, Model.merchant_sku); + db.AddInParameter(cmd, "@in_policy", DbType.String, Model.in_policy); + db.AddInParameter(cmd, "@return_quantity", DbType.Int32, Model.return_quantity); + db.AddInParameter(cmd, "@resolution", DbType.String, Model.resolution); + db.AddInParameter(cmd, "@refund_amount", DbType.Decimal, Model.refund_amount); + db.AddInParameter(cmd, "@tracking_id", DbType.String, Model.tracking_id); + db.AddInParameter(cmd, "@return_carrier", DbType.String, Model.return_carrier); + db.AddInParameter(cmd, "@label_cost", DbType.Decimal, Model.label_cost); + db.AddInParameter(cmd, "@order_date", DbType.DateTime, Model.order_date); + db.AddInParameter(cmd, "@return_request_date", DbType.DateTime, Model.return_request_date); + db.AddInParameter(cmd, "@return_request_status", DbType.String, Model.return_request_status); + db.AddInParameter(cmd, "@ScanDate", DbType.DateTime, Model.ScanDate); + db.AddInParameter(cmd, "@InType", DbType.String, Model.InType); + db.AddInParameter(cmd, "@ScanState", DbType.String, Model.ScanState); + db.AddInParameter(cmd, "@ScanUserId", DbType.Int32, Model.ScanUserId); + db.AddInParameter(cmd, "@remark", DbType.String, Model.remark); + db.AddInParameter(cmd, "@PostionCode", DbType.String, Model.PostionCode); + db.AddInParameter(cmd, "@detailid", DbType.Int32, Model.detailid); db.AddInParameter(cmd, "@barcode", DbType.String, Model.barcode); int a = Convert.ToInt32(db.ExecuteScalar(cmd)); return a; @@ -16753,7 +16758,7 @@ left join HW_GoodsInfo f with(nolock) on e.GoodsId=f.GoodsId"; #region 保存货物出库明细 - public static void updatetracking_id(int id,string tracking_id,int isOfferUp,int isMaketPlace) + public static void updatetracking_id(int id, string tracking_id, int isOfferUp, int isMaketPlace) { string tsql = @" update [DT_OrderReturn] set tracking_id=@tracking_id,isOfferUp=@isOfferUp,isMaketPlace=@isMaketPlace where [id]=@id"; @@ -16836,7 +16841,7 @@ update [DT_OrderReturn] set tracking_id=@tracking_id,isOfferUp=@isOfferUp,isMak db.AddInParameter(cmd, "@Long", DbType.Decimal, Model.Long); db.AddInParameter(cmd, "@Width", DbType.Decimal, Model.Width); db.AddInParameter(cmd, "@Height", DbType.Decimal, Model.Height); - db.AddInParameter(cmd, "@CompanyId", DbType.Int32, Model.CompanyId); + db.AddInParameter(cmd, "@CompanyId", DbType.Int32, Model.CompanyId); db.ExecuteNonQuery(cmd); } @@ -16860,7 +16865,7 @@ select CompanyId=@CompanyId return a; } - public static int CancelOrder(string ordercode,int CompanyId) + public static int CancelOrder(string ordercode, int CompanyId) { @@ -17247,7 +17252,7 @@ values(@info,0,getdate(),0,4,'P',@UserId) public static List GetListStoreYC(DateTime? InDate) { - + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("OrderStore_Compare"); db.AddInParameter(cmd, "@InDate", DbType.DateTime, InDate); @@ -17258,7 +17263,7 @@ values(@info,0,getdate(),0,4,'P',@UserId) #endregion #region 查询货物排名列表 - public static List GetGoodsPM(int ShopId,DateTime InDate, DateTime InDate2) + public static List GetGoodsPM(int ShopId, DateTime InDate, DateTime InDate2) { List list = null; @@ -17363,7 +17368,7 @@ where a.shopid=@ShopId and int3>0 and b.InDate>=@InDate and b.InDate<@InDate2 #endregion #region 查询货物排名列表 - public static List GetGoodsPM2(int ShopId, DateTime InDate, string GoodsCode,int pm1,int pm2) + public static List GetGoodsPM2(int ShopId, DateTime InDate, string GoodsCode, int pm1, int pm2) { List list = null; @@ -17508,7 +17513,7 @@ where a.InDate>='2022-04-28' and b.PlatType=2 and a.escrowFee is null #endregion #region 删除 - public static void UpdatetApiOrders(int id,decimal escrowFee) + public static void UpdatetApiOrders(int id, decimal escrowFee) { string tsql = @" update API_OrderInfo set escrowFee=@escrowFee where OrderId=@id"; @@ -17569,7 +17574,7 @@ select 1"; } #endregion #region 保存 - public static int Save_LXShop(string code,string name) + public static int Save_LXShop(string code, string name) { string tsql = @" INSERT INTO [dbo].[LxShop] @@ -17696,7 +17701,7 @@ inner join cpprice b on a.RecordID=b.ParentID #region 读取畅想价格(东南亚) public static void SaveCXGoods(HW_GoodsNew md) { - + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("CXGoodsAdd"); db.AddInParameter(cmd, "@FileName", DbType.String, ""); @@ -17712,7 +17717,7 @@ inner join cpprice b on a.RecordID=b.ParentID db.AddInParameter(cmd, "@BoxRate", DbType.Int32, md.BoxRate); db.AddInParameter(cmd, "@JYSales", DbType.String, md.JYSales); db.ExecuteNonQuery(cmd); - + } #endregion @@ -17962,7 +17967,7 @@ where a.ChaseId in (" + Ids + ") order by c.GoodsId,b.TypeCode"; } #endregion #region 保存 - public static int Save_CFSKU(int detailid,string sku,string inname) + public static int Save_CFSKU(int detailid, string sku, string inname) { string tsql = @" declare @DetailId2 int @@ -18173,7 +18178,7 @@ select 1 } #endregion #region 取消订单 - public static int DeleteNMOrder(int OutId,string Remark) + public static int DeleteNMOrder(int OutId, string Remark) { @@ -18321,7 +18326,7 @@ end } #endregion #region 货号分配 - public static int UpdateGoodsMate(int platid, int goodsid,int userid,string name) + public static int UpdateGoodsMate(int platid, int goodsid, int userid, string name) { @@ -18452,7 +18457,7 @@ select @Id"; return a; } #endregion - + #region 返回Model public static HW_GoodsUserPlanCount GetModel_GoodsUserPlanCount(int Id) { @@ -18475,13 +18480,13 @@ select @Id"; #region 返回Model public static int GetModel_UserDept(int UserId) { - + string tsql = @" select DeptId=isnull(DeptId,0) from JC_UserInfo where UserId=@UserId"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@UserId", DbType.Int32, UserId); - int deptid=Convert.ToInt32(db.ExecuteScalar(cmd)); + int deptid = Convert.ToInt32(db.ExecuteScalar(cmd)); return deptid; } @@ -18539,7 +18544,7 @@ end #endregion #region 读取人员 - public static List GetListUserInfoFromGroup2(int UserId,int iscp) + public static List GetListUserInfoFromGroup2(int UserId, int iscp) { string tsql = @" if @UserId=1 or @UserId=51 or @UserId=53 or @UserId=225 or @UserId=114 or @iscp=0 @@ -18593,9 +18598,9 @@ end } #endregion - + #region 读取店铺 - public static List GetUserGoodsScore_bak(int UserId,DateTime? sdate, DateTime? edate) + public static List GetUserGoodsScore_bak(int UserId, DateTime? sdate, DateTime? edate) { string tsql = @" --本月订单数据 @@ -18639,7 +18644,7 @@ inner join HW_GoodsInfo c on a.GoodsId=c.GoodsId } #endregion #region 读取店铺 - public static List GetUserGoodsScore(int UserId, DateTime? sdate, DateTime? edate,int SNum,int ENum) + public static List GetUserGoodsScore(int UserId, DateTime? sdate, DateTime? edate, int SNum, int ENum) { string tsql = @" declare @edate1 datetime,@edate2 datetime,@edate3 datetime @@ -18895,10 +18900,10 @@ select *,TGRate=case when KHNum>0 then cast((Num3+Num4+Num5)*100/KHNum as decima db.AddInParameter(cmd, "@sdate", DbType.DateTime, sdate); db.AddInParameter(cmd, "@edate", DbType.DateTime, edate); DataSet ds = db.ExecuteDataSet(cmd); - List list= ds.Tables[0].ToList(); - var datalist = ds.Tables[1].ToList(); - if(list!=null&&list.Count>0) - list[0].Data2 = datalist; + List list = ds.Tables[0].ToList(); + var datalist = ds.Tables[1].ToList(); + if (list != null && list.Count > 0) + list[0].Data2 = datalist; return list; } #endregion @@ -20220,7 +20225,7 @@ select *,TGRate=case when KHNum>0 then cast((Num3+Num4+Num5)*100/KHNum as decima } #endregion #region 保存 - public static int Save_OrderLTLFee(int OrderId,decimal FeeLTL) + public static int Save_OrderLTLFee(int OrderId, decimal FeeLTL) { string tsql = @" Update [DT_OrderInfo] set [FeeLTL]=@FeeLTL where OrderId=@OrderId @@ -20230,7 +20235,7 @@ select 1"; DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@OrderId", DbType.Int32, OrderId); db.AddInParameter(cmd, "@FeeLTL", DbType.Decimal, FeeLTL); - + int a = Convert.ToInt32(db.ExecuteScalar(cmd)); return a; } @@ -20422,9 +20427,9 @@ select @id"; return a; } #endregion - + #region 返回列表 - public static List GetListGoodsLeaveWord(int goodsid,int leavetype,int platid) + public static List GetListGoodsLeaveWord(int goodsid, int leavetype, int platid) { //string tsql = "select a.id,a.leaveword,a.inname,a.indate,a.isread,a.goodsid from HW_GoodsLeaveWord"; string tsql = @" @@ -20449,13 +20454,13 @@ end #endregion #region 计算商品一周的广告花费 - public static decimal GetGoodWeekAdSpend(int goodid,int storeid) + public static decimal GetGoodWeekAdSpend(int goodid, int storeid) { Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("GetGoodWeekADSpendAmountByDate"); db.AddInParameter(cmd, "@goodId", DbType.Int32, goodid); db.AddInParameter(cmd, "@storeId", DbType.Int32, storeid); - var obj=db.ExecuteScalar(cmd); + var obj = db.ExecuteScalar(cmd); return obj == DBNull.Value ? 0 : Convert.ToDecimal(obj); } @@ -20481,7 +20486,7 @@ end /// /// /// - public static List GetStoreGoodWeekAcos (int userId,string name, string shopName,string goodCode,string master, DateTime startDate,DateTime endDate ,int pageIndex,int pageSize, out int rowCount,out decimal? hjSpned,out decimal? hj_ad_sale,out decimal? hjweeklr) + public static List GetStoreGoodWeekAcos(int userId, string name, string shopName, string goodCode, string master, DateTime startDate, DateTime endDate, int pageIndex, int pageSize, out int rowCount, out decimal? hjSpned, out decimal? hj_ad_sale, out decimal? hjweeklr) { string sqlFil = ""; if (!string.IsNullOrEmpty(shopName)) @@ -20507,7 +20512,7 @@ end var allListModel = tb.ToList(); var goodsMasters = GetAllGoodsMasterList(); - foreach(var item in allListModel) + foreach (var item in allListModel) { if (string.IsNullOrEmpty(item.SKU)) { @@ -20524,7 +20529,7 @@ end allListModel = allListModel.Where(r => r.Master.Contains(master)).ToList(); } - if(userId!=1 && userId != 51)//管理员账号看所有,否则只能自己看自己的数据 + if (userId != 1 && userId != 51)//管理员账号看所有,否则只能自己看自己的数据 { allListModel = allListModel.Where(r => !string.IsNullOrEmpty(r.Master) && r.Master.Equals(name, StringComparison.OrdinalIgnoreCase)).ToList(); } @@ -20536,7 +20541,7 @@ end var weekLRs = GetAllGoodsLRList(); decimal _weekrl = 0; - foreach(var item in allListModel) + foreach (var item in allListModel) { var weeklr = weekLRs.Find(r => r.ShopName.ToLower() == item.ShopName.ToLower() && r.GoodsCode == item.SKU); if (weeklr != null) @@ -20601,7 +20606,7 @@ end /// /// /// - public static List GetMasterStoreGoodAcosCountsList(int userid,string userName, DateTime startDate,DateTime endDate, int pageIndex, int pageSize, out int rowCount) + public static List GetMasterStoreGoodAcosCountsList(int userid, string userName, DateTime startDate, DateTime endDate, int pageIndex, int pageSize, out int rowCount) { var sql = @"select g.Name as Master,COUNT(1) as Count from ( select SKU from ( @@ -20619,7 +20624,7 @@ end DataTable tb = db.ExecuteDataTable(cmd); var allListModel = tb.ToList(); var listModel = new List(); - if(userid==1 || userid == 51) + if (userid == 1 || userid == 51) { listModel = allListModel; } @@ -20777,7 +20782,7 @@ select @Id"; #endregion #region 获取财务每天必填资金流数据 - public static List GetFinanceFundDataList(DateTime? SDate,DateTime? EDate,int PageSize,int PageIndex,out int RowCount) + public static List GetFinanceFundDataList(DateTime? SDate, DateTime? EDate, int PageSize, int PageIndex, out int RowCount) { var sqlFile = " where 1=1 "; if (SDate.HasValue) @@ -20945,7 +20950,7 @@ select t.OrderDate,t.ShopId,t.GoodsId,SUM(t.GoodsNum) GoodsNum from ( select CONVERT(nvarchar(100),a.OrderDate,23) as OrderDate, a.ShopId,c.GoodsId , b.GoodsNum from DT_OrderInfo a inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail c on b.DetailId=c.DetailId -where a.OrderId in ("+orderids+")) t group by OrderDate,ShopId,GoodsId ) t1 left join " +where a.OrderId in (" + orderids + ")) t group by OrderDate,ShopId,GoodsId ) t1 left join " + " (select CONVERT(nvarchar(100),DATEADD(day,1,addate),23) addate,shopid,goodsid,SUM(adfeenew) adfee from AD_FeeList group by addate,shopid,goodsid ) t2 on t1.OrderDate=t2.addate and t1.ShopId=t2.shopid and t1.GoodsId=t2.goodsid"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -20957,10 +20962,10 @@ where a.OrderId in ("+orderids+")) t group by OrderDate,ShopId,GoodsId ) t1 left #region 返回列表 - public static List GetListGoodsLeaveWordFromDate(DateTime? sdt, DateTime? edt,int platid,string content) + public static List GetListGoodsLeaveWordFromDate(DateTime? sdt, DateTime? edt, int platid, string content) { //string tsql = "select a.id,a.leaveword,a.inname,a.indate,a.isread,a.goodsid from HW_GoodsLeaveWord"; - string tsql = "select distinct goodsid from HW_GoodsLeaveWord where indate>=@sdt and indate<@edt and platid=@platid and leavetype=1 and (@content='' or leaveword like '%"+content+"%')"; + string tsql = "select distinct goodsid from HW_GoodsLeaveWord where indate>=@sdt and indate<@edt and platid=@platid and leavetype=1 and (@content='' or leaveword like '%" + content + "%')"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@sdt", DbType.DateTime, sdt); @@ -20974,7 +20979,7 @@ where a.OrderId in ("+orderids+")) t group by OrderDate,ShopId,GoodsId ) t1 left #endregion #region 返回列表 - public static List GetListGoodsOrdersFromDate(DateTime? sdt, DateTime? edt,string goodsids, int platid) + public static List GetListGoodsOrdersFromDate(DateTime? sdt, DateTime? edt, string goodsids, int platid) { //string tsql = "select a.id,a.leaveword,a.inname,a.indate,a.isread,a.goodsid from HW_GoodsLeaveWord"; string tsql = @"select c.GoodsId,GoodsNum=SUM(a.GoodsNum) from DT_OrderGoods a with(nolock) @@ -21113,7 +21118,7 @@ where b.State > 0 and b.State < 3 and b.PlatId=@platid and b.OrderDate >=@sdt an #endregion #region 获取个人广告花费详情 - public static List GetPeopleAdFeeDetailList(int userid, DateTime? sDate,DateTime? eDate) + public static List GetPeopleAdFeeDetailList(int userid, DateTime? sDate, DateTime? eDate) { //var filt = ""; //if (sDate.HasValue) @@ -21155,7 +21160,7 @@ select d.GoodsCode,d.GoodsName, a.AdFee,b.OrderNum,b.TotalPrice,c.AdOrdersNum,c #endregion #region 获取所有人每人每天的销售额数据 - public static List GetPeopleDaySalePriceList(DateTime sdt,DateTime edt) + public static List GetPeopleDaySalePriceList(DateTime sdt, DateTime edt) { var sql = @"select x.guserid as UserId,CONVERT(nvarchar(23), x.Date) as RDate,ISNULL(z.TotalPrice,0) TotalPrice from ( --找到所有运营人员,以及日期做笛卡尔积 @@ -21295,7 +21300,7 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId group by a.guserid_sheIn"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - + DataTable dt = db.ExecuteDataTable(cmd); List ListModel = dt.ToList(); return ListModel; @@ -21338,7 +21343,7 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where " + filt + " group by #endregion #region 获取每个人当天的库存花费 - public static List GetPeopleDayStockFee(DateTime? sDate,DateTime? eDate) + public static List GetPeopleDayStockFee(DateTime? sDate, DateTime? eDate) { var filter = " where 1=1 "; if (sDate.HasValue) @@ -21407,7 +21412,7 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where " + filt + " group by #endregion #region 获取某平台每人每天的订单数量数据 - public static List GetNoAmazonPeopleDayOrderNumList(int platid,int userid, DateTime sdt, DateTime edt) + public static List GetNoAmazonPeopleDayOrderNumList(int platid, int userid, DateTime sdt, DateTime edt) { var sql = @"select CONVERT(nvarchar(23), t1.Date) RDate,ISNULL( OrderNum,0) OrderNum,@userid as UserId from ( SELECT CONVERT(date, DATEADD(DAY, number, @startDate)) AS [Date] FROM master..spt_values WHERE type = 'P'AND number <= DATEDIFF(DAY, @startDate, @endDate) @@ -21759,13 +21764,13 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where " + filt + " group by select distinct a.platid, Case when a.PlatId=3 then guserid_ebay when a.PlatId=6 then guserid_wlmart when a.PlatId=15 then guserid_shopify when a.PlatId=18 then guserid_wayfair when a.PlatId=21 then guserid_sheIn end guserid from DT_OrderInfo a inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail c on b.DetailId=c.DetailId inner join HW_GoodsInfo d on c.GoodsId=d.GoodsId where a.State>0 and a.State<3 and a.PlatId in (" + platids + ") and CONVERT(date, a.OrderDate)>=@startDate and CONVERT(date, a.OrderDate)<=@endDate ) e"; - sql+= @" Cross join (SELECT CONVERT(nvarchar(7), DATEADD(MONTH, number, @startDate),120) AS [Date] FROM master..spt_values WHERE type = 'P'AND number <= DATEDIFF(MONTH, @startDate, @endDate)) t + sql += @" Cross join (SELECT CONVERT(nvarchar(7), DATEADD(MONTH, number, @startDate),120) AS [Date] FROM master..spt_values WHERE type = 'P'AND number <= DATEDIFF(MONTH, @startDate, @endDate)) t )x left join ( select t.PlatId, t.OrderDate,t.guserid,SUM(t.TotalPrice) TotalPrice from ( select a.PlatId, CONVERT(varchar(7), dateadd(hour,12, a.OrderDate), 120) OrderDate,Case when a.PlatId=3 then guserid_ebay when a.PlatId=6 then guserid_wlmart when a.PlatId=15 then guserid_shopify when a.PlatId=18 then guserid_wayfair when a.PlatId=21 then guserid_sheIn end guserid , a.TotalPrice from DT_OrderInfo a inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail c on b.DetailId=c.DetailId inner join HW_GoodsInfo d on c.GoodsId=d.GoodsId - where a.State>0 and a.State<3 and a.PlatId in (" + platids+ ") and CONVERT(date, a.OrderDate)>=@startDate and CONVERT(date, a.OrderDate)<=@endDate) t group by OrderDate,guserid,PlatId )z on x.Date=z.OrderDate and x.PlatId=z.PlatId and ISNULL( x.guserid,0)=ISNULL(z.guserid,0) order by x.PlatId, x.guserid ,Date "; + where a.State>0 and a.State<3 and a.PlatId in (" + platids + ") and CONVERT(date, a.OrderDate)>=@startDate and CONVERT(date, a.OrderDate)<=@endDate) t group by OrderDate,guserid,PlatId )z on x.Date=z.OrderDate and x.PlatId=z.PlatId and ISNULL( x.guserid,0)=ISNULL(z.guserid,0) order by x.PlatId, x.guserid ,Date "; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -21827,7 +21832,7 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where " + filt + " group by #endregion #region 获取每人每月的订单数量数据 - public static List GetPeopleMonthOrderNumList(int userid,int platid, DateTime sdt, DateTime edt) + public static List GetPeopleMonthOrderNumList(int userid, int platid, DateTime sdt, DateTime edt) { var sql = @" select t2.Date,t1.guserid,t1.OrderNum from ( @@ -21855,7 +21860,7 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where " + filt + " group by #endregion #region 获取所有人每人每月的订单数量数据 - public static List GetAllPeopleMonthOrderNumList( int platid, DateTime sdt, DateTime edt) + public static List GetAllPeopleMonthOrderNumList(int platid, DateTime sdt, DateTime edt) { var sql = @" @@ -22217,7 +22222,7 @@ from #ls_1 a left join #ls_2 b on a.UserId=b.UserId and a.RDate=b.RDate left jo #endregion #region 获取shopify平台店铺所有订单 - public static List GetShopifyShopAllOrdersList(DateTime? sdate,DateTime? edate,int shopid,int pageIndex,int pageSize ,out int rowCount) + public static List GetShopifyShopAllOrdersList(DateTime? sdate, DateTime? edate, int shopid, int pageIndex, int pageSize, out int rowCount) { var filt = ""; if (shopid != 0) @@ -22265,11 +22270,11 @@ where ISNULL( b.FirstImgUrl,'')<>'' and a.shopifyorder_id in (" + orderids + ")" #endregion #region 更新shopify订单抓取状态 - public static void UpdateShopifyOrderCaptureState(string shopifyOrderId,int status) + public static void UpdateShopifyOrderCaptureState(string shopifyOrderId, int status) { string sql = @" update ShopifyShopsOrders set CaptureState=" + status + " where shopifyorder_id='" + shopifyOrderId + "'"; - Database db=DatabaseFactory.CreateDatabase(); + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); db.ExecuteNonQuery(cmd); } @@ -22306,7 +22311,7 @@ where ISNULL( b.FirstImgUrl,'')<>'' and a.shopifyorder_id in (" + orderids + ")" public static List GetGoodsLast2DayAdFeeListByOrders(string oids) { string tsql = @"select distinct b.GoodsId into #ls_1 from DT_OrderGoods a with (nolock) inner join HW_GoodsDetail b with (nolock) on a.DetailId = b.DetailId where OrderId in (" + oids + ") "; - tsql+=@" select shopid, t1.goodsid,SUM(ABS(isnull(adfee, 0))) spend from AD_FeeList t1 inner join #ls_1 t2 on t1.goodsid=t2.GoodsId + tsql += @" select shopid, t1.goodsid,SUM(ABS(isnull(adfee, 0))) spend from AD_FeeList t1 inner join #ls_1 t2 on t1.goodsid=t2.GoodsId where CONVERT(date, addate) = CONVERT(date, DATEADD(day, -2, GETDATE())) group by t1.goodsid,shopid "; Database db = DatabaseFactory.CreateDatabase(); @@ -22389,7 +22394,7 @@ where CONVERT(date,RequestDate)>=CONVERT(date,DATEADD(day,-30,getdate())) group #endregion #region 获取个人销售数据页面留言数据 - public static void UpdatePeopleSaleDataRemark(int userid,int platid, string username,string remark,int isgroup=0) + public static void UpdatePeopleSaleDataRemark(int userid, int platid, string username, string remark, int isgroup = 0) { string tsql = " if(exists(select 1 from PeopleSaleDatasRemark where UserId=" + userid + " and platid=" + platid + " and IsGroup=" + isgroup + "))\r\n begin\r\n Update PeopleSaleDatasRemark set Remark='" + remark + "' where UserId=" + userid + " and platid=" + platid + " and IsGroup=" + isgroup + " \r\n end\r\nelse\r\n begin\r\n insert into PeopleSaleDatasRemark (UserId,PlatId, UserName,Remark,IsGroup,CreateTime) values(" + userid + "," + platid + ", '" + username + "','" + remark + "'," + isgroup + ",GetDate())\r\n end"; Database db = DatabaseFactory.CreateDatabase(); @@ -22399,7 +22404,7 @@ where CONVERT(date,RequestDate)>=CONVERT(date,DATEADD(day,-30,getdate())) group #endregion #region 获取个人销售数据页面产品类目数据 - public static void UpdatePeopleSaleDataPCategorys(int userid, int platid, string username, string categorys,int isgroup=0) + public static void UpdatePeopleSaleDataPCategorys(int userid, int platid, string username, string categorys, int isgroup = 0) { string tsql = " if(exists(select 1 from PeopleSaleDatasRemark where UserId=" + userid + " and platid=" + platid + " and IsGroup=" + isgroup + "))\r\n begin\r\n Update PeopleSaleDatasRemark set Categorys='" + categorys + "' where UserId=" + userid + " and platid=" + platid + " and IsGroup=" + isgroup + " \r\n end\r\nelse\r\n begin\r\n insert into PeopleSaleDatasRemark (UserId,PlatId, UserName,Categorys,IsGroup,CreateTime) values(" + userid + "," + platid + ", '" + username + "','" + categorys + "'," + isgroup + ",GetDate())\r\n end"; Database db = DatabaseFactory.CreateDatabase(); @@ -22409,7 +22414,7 @@ where CONVERT(date,RequestDate)>=CONVERT(date,DATEADD(day,-30,getdate())) group #endregion #region 获取订单商品的大小类排名 - public static List GetGoodsRankModelList(string shopids,DateTime? maxDate,DateTime? minDate) + public static List GetGoodsRankModelList(string shopids, DateTime? maxDate, DateTime? minDate) { string filt = ""; if (maxDate.HasValue) @@ -22448,7 +22453,7 @@ where CONVERT(date,RequestDate)>=CONVERT(date,DATEADD(day,-30,getdate())) group #endregion #region 获取每个人商品排名详情 - public static List GetPeopleGoodsRankDetailList(DateTime sdate,int rangeType,int userid,int PageIndex,int PageSize,out int rowCount) + public static List GetPeopleGoodsRankDetailList(DateTime sdate, int rangeType, int userid, int PageIndex, int PageSize, out int rowCount) { string filt = ""; switch (rangeType) @@ -22511,7 +22516,7 @@ where CONVERT(date,RequestDate)>=CONVERT(date,DATEADD(day,-30,getdate())) group #region 返回除亚马逊平台外其他平台个人每天的销售数据 - public static List GetNoAmazonPeopleDaySaleDatasList( DateTime? sdt, DateTime? edt) + public static List GetNoAmazonPeopleDaySaleDatasList(DateTime? sdt, DateTime? edt) { var sql = @" @@ -22576,7 +22581,7 @@ where a.State>0 and a.State<3 and a.PlatId!=2 and CONVERT(date, a.OrderDate)>=@s #endregion #region 更新商品方案数 - public static void UpdateGoodsPlanCount(int goodsid ,int? planCount) + public static void UpdateGoodsPlanCount(int goodsid, int? planCount) { string tsql = " update HW_GoodsInfo set PlanCount=" + (planCount.HasValue ? planCount.Value.ToString() : "null") + " where GoodsId=" + goodsid; Database db = DatabaseFactory.CreateDatabase(); @@ -22606,7 +22611,7 @@ where a.State>0 and a.State<3 and a.PlatId!=2 and CONVERT(date, a.OrderDate)>=@s #endregion #region 获取店铺广告花费详情 - public static List GetShopAdFeeDetailList(int userid, DateTime? sDate,DateTime? eDate, string shopName,int PageIndex,int PageSize,out int rowCount) + public static List GetShopAdFeeDetailList(int userid, DateTime? sDate, DateTime? eDate, string shopName, int PageIndex, int PageSize, out int rowCount) { //var tsql = @" select COUNT(1) as count from AD_FeeList a left join HW_GoodsInfo b on a.goodsid=b.GoodsId where isnull(a.goodscode,'')<>'' and addate=@sDate and shopname=@shopName // select GoodsCode,GoodsName,DetailId, AdFee,UserId,UserName,SaleAmount,OrderNum,Ad_SaleAmount,Ad_OrderNum from ( @@ -22632,7 +22637,7 @@ where a.State>0 and a.State<3 and a.PlatId!=2 and CONVERT(date, a.OrderDate)>=@s db.AddInParameter(cmd, "@eDate", DbType.Date, eDate); db.AddInParameter(cmd, "@shopName", DbType.String, shopName); - DataSet dst=db.ExecuteDataSet(cmd); + DataSet dst = db.ExecuteDataSet(cmd); rowCount = Convert.ToInt32(dst.Tables[0].Rows[0]["count"]); List ListModel = dst.Tables[1].ToList(); @@ -22641,7 +22646,7 @@ where a.State>0 and a.State<3 and a.PlatId!=2 and CONVERT(date, a.OrderDate)>=@s #endregion #region 获取店铺广告花费详情汇总 - public static ShopAdFeeDetailModel GetShopAdFeeDetailTotal(int userid, DateTime? sDate,DateTime? eDate, string shopName) + public static ShopAdFeeDetailModel GetShopAdFeeDetailTotal(int userid, DateTime? sDate, DateTime? eDate, string shopName) { var tsql = @" select SUM( ABS(ISNULL( a.adfee,0))) AdFee ,SUM( ISNULL(a.SaleAmount,0)) SaleAmount,SUM( ISNULL(a.OrderNum,0)) OrderNum,SUM(ISNULL(a.AD_SaleAmount,0)) Ad_SaleAmount,SUM(ISNULL(a.Ad_OrderNum,0)) Ad_OrderNum @@ -22653,7 +22658,7 @@ from AD_FeeList a Inner join HW_GoodsInfo b on a.goodsid=b.GoodsId where isnull( db.AddInParameter(cmd, "@shopName", DbType.String, shopName); DataTable dt = db.ExecuteDataTable(cmd); - var rmodel=new ShopAdFeeDetailModel(); + var rmodel = new ShopAdFeeDetailModel(); rmodel.GoodsCode = "汇总"; rmodel.AdFee = Convert.ToDecimal(dt.Rows[0]["AdFee"]); rmodel.OrderNum = Convert.ToInt32(dt.Rows[0]["OrderNum"]); @@ -22687,7 +22692,7 @@ from AD_FeeList a Inner join HW_GoodsInfo b on a.goodsid=b.GoodsId where isnull( (case when ISNULL(c.tc,0)<=0 then IsNull(c.tc,0) else c.tc end)-IsNull(d.FactPrice,0)-IsNull(d.PostFee,0)-IsNull(c.md,0)-IsNull(a.DR_BackFee,0)-IsNull(a.DR_PostFee,0)-IsNull(a.DR_SSFee,0))) LR from ( SELECT a.OrderId,c.GoodsId FROM DT_OrderInfo A inner JOIN DT_OrderGoods B ON A.OrderId=B.OrderId inner join HW_GoodsDetail c on b.DetailId =c.DetailId inner join HW_GoodsInfo d on d.goodsid=c.goodsid WHERE CONVERT(date,DATEADD(hour,-15,a.OrderDate))>=@sDate and CONVERT(date,DATEADD(hour,-15,a.OrderDate))<=@eDate " + filt + " and ShopId=(select top 1 ShopId from JC_Shop where ShopName=@shopName) AND A.PlatId=2 group by a.OrderId,c.GoodsId) t "; - sql+=" inner join DT_OrderInfo a on t.OrderId=a.OrderId left join DT_Fees c on a.OrderId=c.orderid left join DT_OrderBackMoneyApply d on a.OrderId=d.OrderId group by GoodsId"; + sql += " inner join DT_OrderInfo a on t.OrderId=a.OrderId left join DT_Fees c on a.OrderId=c.orderid left join DT_OrderBackMoneyApply d on a.OrderId=d.OrderId group by GoodsId"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -22702,7 +22707,7 @@ from AD_FeeList a Inner join HW_GoodsInfo b on a.goodsid=b.GoodsId where isnull( #region 获取个人每天的H净利润 - public static List GetPeopleDayHJLRList(DateTime sdate,DateTime edate) + public static List GetPeopleDayHJLRList(DateTime sdate, DateTime edate) { var tsql = @" --广告费 @@ -22765,7 +22770,7 @@ select convert(nvarchar(120) ,a.AdDate) RDate,isnull(a.guserid ,0) UserId,HJLR= return count; } - public static void CancelCGPlan(string detailids,int year) + public static void CancelCGPlan(string detailids, int year) { var sql = @" update HW_GoodsDetail set FHPlan=null where DetailId in (" + detailids + ") delete from HW_GoodsBFPlan where id in (select t.id from ( select ROW_NUMBER() over(order by weekno desc) row,id from HW_GoodsBFPlan where sjout=0 and year=" + year + " and detailid in (" + detailids + ") ) t where t.row=1) "; @@ -22777,7 +22782,7 @@ select convert(nvarchar(120) ,a.AdDate) RDate,isnull(a.guserid ,0) UserId,HJLR= #region 获取店铺广告花费详情 - public static List GetShopAdAnalysisDetailList(DateTime? sDate, DateTime? eDate, int shopid,int userid, int PageIndex, int PageSize, out int rowCount) + public static List GetShopAdAnalysisDetailList(DateTime? sDate, DateTime? eDate, int shopid, int userid, int PageIndex, int PageSize, out int rowCount) { string fitStr = ""; if (shopid != 0) @@ -22799,7 +22804,7 @@ into #ls2 from ( SELECT a.ShopId, a.OrderId,c.GoodsId FROM DT_OrderInfo A inner JOIN DT_OrderGoods B ON A.OrderId=B.OrderId inner join HW_GoodsDetail c on b.DetailId =c.DetailId inner join HW_GoodsInfo d on c.GoodsId=d.GoodsId WHERE CONVERT(date,DATEADD(hour,-15,a.OrderDate))>=@sDate and CONVERT(date,DATEADD(hour,-15,a.OrderDate))<=@eDate AND A.PlatId=2 " + fitStr + " group by a.OrderId,c.GoodsId,a.ShopId) t "; - tsql+=@" + tsql += @" inner join DT_OrderInfo a on t.OrderId=a.OrderId left join DT_Fees c on a.OrderId=c.orderid left join DT_OrderBackMoneyApply d on a.OrderId=d.OrderId group by t.ShopId, GoodsId @@ -22824,14 +22829,14 @@ select ROW_NUMBER() over(order by a.AdFee desc) row, a.ShopName,a.GoodsId,a.Good #region 获取店铺索赔Case - public static List GetShopClaimCaseList(DateTime? sDate, DateTime? eDate, int? shopid, int searchType,string searchTxt, int PageIndex, int PageSize, out int rowCount) + public static List GetShopClaimCaseList(DateTime? sDate, DateTime? eDate, int? shopid, int searchType, string searchTxt, int PageIndex, int PageSize, out int rowCount) { var filt = " 1=1 "; if (sDate.HasValue) filt += " and CONVERT(date, a.SPDate)>='" + sDate.Value.ToString("yyyy-MM-dd") + "'"; if (eDate.HasValue) filt += " and CONVERT(date, a.SPDate)<='" + eDate.Value.ToString("yyyy-MM-dd") + "'"; - if (shopid.HasValue&& shopid!=0) + if (shopid.HasValue && shopid != 0) { filt += " and b.ShopId=" + shopid; } @@ -22863,7 +22868,7 @@ select ROW_NUMBER() over(order by a.AdFee desc) row, a.ShopName,a.GoodsId,a.Good var sql = @"select COUNT(1) as count from ShopClaimCase a left join DT_OrderInfo b on a.OrderCode=b.OrderCode left join JC_Shop c on b.ShopId=c.ShopId where " + filt; sql += @" select ID,ShopId,ShopName,PlatType,OrderCode,SPDate,IsAffectODR,GoodsCodes,GoodPrice,SPDetail,ContactAmazon,RefundCustomerPrice,ContactCustomer,Remark from ( select ROW_NUMBER() over(order by a.CreateTime desc) row, a.ID, c.ShopId,c.ShopName,c.PlatType, a.OrderCode,CONVERT(nvarchar(20), SPDate,23) SPDate,case when IsAffectODR=1 then '是' else '否' end IsAffectODR,GoodsCodes,GoodPrice,SPDetail,ContactAmazon,RefundCustomerPrice,ContactCustomer,Remark - from ShopClaimCase a left join DT_OrderInfo b on a.OrderCode=b.OrderCode left join JC_Shop c on b.ShopId=c.ShopId where " + filt+ ") t where t.row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize); + from ShopClaimCase a left join DT_OrderInfo b on a.OrderCode=b.OrderCode left join JC_Shop c on b.ShopId=c.ShopId where " + filt + ") t where t.row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize); Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -22897,7 +22902,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= public static int SaveShopClaimCaseData(ShopClaimCaseData Model) { var tsql = ""; - if(Model.ID==null || Model.ID == 0) + if (Model.ID == null || Model.ID == 0) { tsql += " insert into ShopClaimCase(OrderCode,SPDate,IsAffectODR,GoodsCodes,GoodPrice,SPDetail,ContactAmazon,RefundCustomerPrice,ContactCustomer,Remark,CreateTime) values(@OrderCode,@SPDate,@IsAffectODR,@GoodsCodes,@GoodPrice,@SPDetail,@ContactAmazon,@RefundCustomerPrice,@ContactCustomer,@Remark,GETDATE()) select SCOPE_IDENTITY()"; } @@ -22960,9 +22965,9 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #endregion #region 获取店铺的邮件列表数据 - public static List GetShopEmailsItemListDatas(int shopid,string emailCode,int pageSize,int pageIndex) + public static List GetShopEmailsItemListDatas(int shopid, string emailCode, int pageSize, int pageIndex) { - var sql = " select ID,ShopId,IsRead,case when DATEDIFF(day, EmailCNTime,getdate())>0 then CONVERT(varchar(5),EmailCNTime,101) else CONVERT(varchar(5),EmailCNTime,108) end EmailCNTime,FromAccount,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over( order by IsRead asc, EmailCNTime desc) row, ID,ShopId, IsRead,EmailCNTime,FromAccount,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over(partition by FromAccount order by IsRead asc, EmailCNTime desc) row,* from ShopEmailDatas where Shopid="+shopid+" and ToAccount like '%" + emailCode+ "%' and FromAccount like '%@marketplace.amazon.com%') t where t.row=1 ) t2 where t2.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; + var sql = " select ID,ShopId,IsRead,case when DATEDIFF(day, EmailCNTime,getdate())>0 then CONVERT(varchar(5),EmailCNTime,101) else CONVERT(varchar(5),EmailCNTime,108) end EmailCNTime,FromAccount,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over( order by IsRead asc, EmailCNTime desc) row, ID,ShopId, IsRead,EmailCNTime,FromAccount,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over(partition by FromAccount order by IsRead asc, EmailCNTime desc) row,* from ShopEmailDatas where Shopid=" + shopid + " and ToAccount like '%" + emailCode + "%' and FromAccount like '%@marketplace.amazon.com%') t where t.row=1 ) t2 where t2.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); @@ -22974,7 +22979,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #region 获取店铺的发件箱邮件列表数据 public static List GetShopSendEmailsItemListDatas(int shopid, string emailCode, int pageSize, int pageIndex) { - var sql = " select ID,ShopId,IsRead,case when DATEDIFF(day, EmailCNTime,getdate())>0 then CONVERT(varchar(5),EmailCNTime,101) else CONVERT(varchar(5),EmailCNTime,108) end EmailCNTime,ToAccount as FromAccount ,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over(order by emailCNTime desc) row,ID,ShopId,IsRead,EmailCNTime,ToAccount ,Subject,EmailContent,OrderCode from ShopEmailDatas where Shopid="+shopid+" and EmailType=1 and FromAccount like '%" + emailCode+ "%') t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; + var sql = " select ID,ShopId,IsRead,case when DATEDIFF(day, EmailCNTime,getdate())>0 then CONVERT(varchar(5),EmailCNTime,101) else CONVERT(varchar(5),EmailCNTime,108) end EmailCNTime,ToAccount as FromAccount ,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over(order by emailCNTime desc) row,ID,ShopId,IsRead,EmailCNTime,ToAccount ,Subject,EmailContent,OrderCode from ShopEmailDatas where Shopid=" + shopid + " and EmailType=1 and FromAccount like '%" + emailCode + "%') t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); @@ -22986,7 +22991,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #region 获取店铺的收件箱邮件列表数据 public static List GetShopGetEmailsItemListDatas(int shopid, string emailCode, int pageSize, int pageIndex) { - var sql = " select ID,ShopId,IsRead,case when DATEDIFF(day, EmailCNTime,getdate())>0 then CONVERT(varchar(5),EmailCNTime,101) else CONVERT(varchar(5),EmailCNTime,108) end EmailCNTime,FromAccount ,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over(order by emailCNTime desc) row,ID,ShopId,IsRead,EmailCNTime,FromAccount ,Subject,EmailContent,OrderCode from ShopEmailDatas where Shopid="+shopid+" and EmailType=0 and ToAccount like '%" + emailCode+"%') t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; + var sql = " select ID,ShopId,IsRead,case when DATEDIFF(day, EmailCNTime,getdate())>0 then CONVERT(varchar(5),EmailCNTime,101) else CONVERT(varchar(5),EmailCNTime,108) end EmailCNTime,FromAccount ,Subject,EmailContent,OrderCode from (\r\nselect ROW_NUMBER() over(order by emailCNTime desc) row,ID,ShopId,IsRead,EmailCNTime,FromAccount ,Subject,EmailContent,OrderCode from ShopEmailDatas where Shopid=" + shopid + " and EmailType=0 and ToAccount like '%" + emailCode + "%') t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); DataTable dt = db.ExecuteDataTable(cmd); @@ -22996,7 +23001,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #endregion #region 获取站内信数据 - public static List GetShopZNXListDatas(int shopid, string emailCode,string customerEmail, int pageSize, int pageIndex) + public static List GetShopZNXListDatas(int shopid, string emailCode, string customerEmail, int pageSize, int pageIndex) { var sql = " select ID,EmailCNTime, EmailContent ,EmailType from (\r\nselect ROW_NUMBER() over(order by EmailCNTime desc) row,ID,CONVERT(nvarchar(100),EmailCNTime,120) EmailCNTime,EmailContent EmailContent,EmailType from ShopEmailDatas where Shopid=" + shopid + " and (FromAccount like '%" + emailCode + "%' and ToAccount like '%" + customerEmail + "%') or (FromAccount like '%" + customerEmail + "%' and ToAccount like '%" + emailCode + "%') \r\n) t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; Database db = DatabaseFactory.CreateDatabase(); @@ -23021,7 +23026,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #endregion #region - public static void InsertShopEmailData(string sellerEmail,string customerEmail,int shopid,string orderid,string content) + public static void InsertShopEmailData(string sellerEmail, string customerEmail, int shopid, string orderid, string content) { var sql = @" insert into ShopEmailDatas (ShopId,IsRead,EmailCNTime,FromAccount,ToAccount,Importance,TextBody,CreateTime,EmailType,EmailContent,OrderCode) values(" + shopid + ",1,getdate(),'" + sellerEmail + "','" + customerEmail + "','Normal','" + content + "',getdate(),1,'" + content + "','" + orderid + "')"; Database db = DatabaseFactory.CreateDatabase(); @@ -23032,7 +23037,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #region 获取人员每天填写的销售数据 - public static List GetPeopleDayFillSaleDataList(int UserId, DateTime? SDate, DateTime? EDate, int PageIndex, int PageSize,out int rowCount) + public static List GetPeopleDayFillSaleDataList(int UserId, DateTime? SDate, DateTime? EDate, int PageIndex, int PageSize, out int rowCount) { string filt = " where 1=1 "; if (UserId != 0) @@ -23055,7 +23060,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #endregion #region 新增人员每天填写的销售数据 - public static void InsertPeopleDayFillSaleDataList(int? ID, int UserId, DateTime? InDate,decimal? AdFee,decimal? TCB,int? AdOrderNum, decimal? AdSaleAmount) + public static void InsertPeopleDayFillSaleDataList(int? ID, int UserId, DateTime? InDate, decimal? AdFee, decimal? TCB, int? AdOrderNum, decimal? AdSaleAmount) { var sql = ""; if (!ID.HasValue || ID == 0) @@ -23093,7 +23098,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #endregion #region 获取EBAY平台的每个人的仓储费 - public static List GetEbayPeopleDayStockSolidFeeDatas(DateTime? sDate,DateTime? eDate) + public static List GetEbayPeopleDayStockSolidFeeDatas(DateTime? sDate, DateTime? eDate) { var filt = " "; if (sDate.HasValue) @@ -23173,7 +23178,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #region 获取ebay店铺总的广告费 public static decimal GetEbayPeopleDayTotalAdfee(string userids, DateTime? sDate, DateTime? eDate) { - var sql = " select SUM(ISNULL(adfee,0)) Adfee from PeopleDayFillSaleData where UserId in ("+userids+ ") and CONVERT(date,InDate)>=@sDate and CONVERT(date,InDate)<=@eDate"; + var sql = " select SUM(ISNULL(adfee,0)) Adfee from PeopleDayFillSaleData where UserId in (" + userids + ") and CONVERT(date,InDate)>=@sDate and CONVERT(date,InDate)<=@eDate"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -23230,7 +23235,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #region 获取Walmart平台的净利润数据 - public static List GetWalmartPeopleHJLRDataList(DateTime sDate,DateTime eDate) + public static List GetWalmartPeopleHJLRDataList(DateTime sDate, DateTime eDate) { var sql = @" --订单利润 @@ -23260,7 +23265,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= db.AddInParameter(cmd, "@sDate", DbType.Date, sDate.Date); db.AddInParameter(cmd, "@eDate", DbType.Date, eDate.Date); - var dt=db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } @@ -23305,7 +23310,7 @@ select case when @plat=2 then muserid when @plat=3 then guserid_ebay when @plat= #region 获取Shopify平台每个店铺的销售数据 - public static List GetShopifyDaySaleDatas(DateTime sdate,DateTime edate) + public static List GetShopifyDaySaleDatas(DateTime sdate, DateTime edate) { var sql = @"--SHopify每个店铺的订单数量,及订单总金额 create table #ls_0(shopid int not null) insert #ls_0(shopid) select ShopId from JC_Shop where ShopId in (56,61,83,88) @@ -23355,7 +23360,7 @@ case when z.ShopId=56 then CONVERT(decimal(12,2), @total_CCFee*0.02) when z.Shop #endregion #region 获取Shopify平台每个店铺的净利润数据 - public static List GetShopifyHJLRDatas(DateTime sdate,DateTime edate) + public static List GetShopifyHJLRDatas(DateTime sdate, DateTime edate) { var sql = @"--广告费 select CONVERT(date,DATEADD(day,-1, InDate)) InDate, ShopId,SUM(ISNULL(Rate3,0)) Adfee into #ls_1 from JC_ShopData where ShopId in (56,61,83,88) and CONVERT(date,DATEADD(day,-1, InDate))>=@sDate and CONVERT(date,DATEADD(day,-1, InDate))<=@eDate group by CONVERT(date,DATEADD(day,-1, InDate)), ShopId @@ -23412,7 +23417,7 @@ select a.ShopId,a.InDate,b.Adfee,c.LR, d.ccfee CCFee from #ls_4 a left join #ls_ #region 获取shopify平台的销售额折线图 - public static List GetShopifyPeopleDaySalePriceDatas(DateTime sdate,DateTime edate) + public static List GetShopifyPeopleDaySalePriceDatas(DateTime sdate, DateTime edate) { var sql = @"select 15 PlatId, t1.ShopId UserId,convert(nvarchar(100), t1.InDate,23) RDate,t2.TotalPrice from ( select a.ShopId,b.Date InDate from JC_Shop a @@ -23611,14 +23616,14 @@ select 22 PlatId, a.ShopId UserId,Convert(nvarchar(7) ,a.InDate,120) RDate,b.Tot /// /// 运费 /// 仓库:241是RANCHO,242是E仓 - public static void UpdateOrderUPSPostFee(int orderid,decimal postfee,int postid,string upslog) + public static void UpdateOrderUPSPostFee(int orderid, decimal postfee, int postid, string upslog) { var sql = ""; if (postid == 241) { sql = @" update DT_OrderInfo set UpsFeeR=@postfee,UpsFeelog=@upslog where OrderId=@orderid"; } - else if(postid==242) + else if (postid == 242) { sql = @" update DT_OrderInfo set UpsFeeE=@postfee,UpsFeelog=@upslog where OrderId=@orderid"; } @@ -23878,14 +23883,14 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b #region 获取退货订单 - public static List GetRefundOrderListDatas(int? shopId,int dateType,DateTime? sDate,DateTime? eDate,string orderId,int searchType,string search,int? isComp, int pageIndex,int pageSize, out int rowCount) + public static List GetRefundOrderListDatas(int? shopId, int dateType, DateTime? sDate, DateTime? eDate, string orderId, int searchType, string search, int? isComp, int pageIndex, int pageSize, out int rowCount) { var filt = " where 1=1 "; - if(shopId.HasValue && shopId.Value != 0) + if (shopId.HasValue && shopId.Value != 0) { filt += " and a.ShopId=" + shopId; } - if(isComp.HasValue && isComp.Value == 1) + if (isComp.HasValue && isComp.Value == 1) { filt += " and (a.CompleteState=0 or a.CompleteState is null)"; } @@ -23922,11 +23927,11 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b { filt += " and b.MerchantSku like '%" + search + "%'"; } - else if (searchType==1) //ASIN + else if (searchType == 1) //ASIN { filt += " and b.ASIN like '%" + search + "%'"; } - else if(searchType==2) //TrackingId 跟踪码 + else if (searchType == 2) //TrackingId 跟踪码 { filt += " and c.TrackingId like '%" + search + "%'"; } @@ -23987,7 +23992,7 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b #endregion #region 更新HW_GoodsInfo表数据的显示隐藏 - public static void UpdateGoodsInfoXSYC(int goodsid,int isyc) + public static void UpdateGoodsInfoXSYC(int goodsid, int isyc) { var sql = @" Update HW_GoodsInfo set isyc=" + isyc + " where GoodsId= " + goodsid; Database db = DatabaseFactory.CreateDatabase(); @@ -23998,12 +24003,12 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b #region 商品类目关联店铺 - public static List GetGoodsSortShopDatas(int? sortId,int? shopId,int PageIndex,int PageSize,out int rowCount) + public static List GetGoodsSortShopDatas(int? sortId, int? shopId, int PageIndex, int PageSize, out int rowCount) { var filt = " where 1=1 "; - if (sortId.HasValue && sortId.Value!=0) + if (sortId.HasValue && sortId.Value != 0) filt += " and a.SortId=" + sortId; - if (shopId.HasValue && shopId.Value!=0) + if (shopId.HasValue && shopId.Value != 0) filt += " and a.ShopId=" + shopId; var sql = @" select COUNT(1) count from GoodsSortShop a left join HW_GoodsSort b on a.SortId=b.SortId left join JC_Shop c on a.ShopId=c.ShopId " + filt; @@ -24017,7 +24022,7 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b return ds.Tables[1].ToList(); } - public static int InsertGoodsSortShop(int sortId,int shopId) + public static int InsertGoodsSortShop(int sortId, int shopId) { var sql = @"if(exists(select 1 from GoodsSortShop where SortId=@sortId and ShopId=@shopId)) select 0 as ID @@ -24069,7 +24074,7 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b var sql = @" select a.GoodsId,a.SortId,b.ShopId,c.ShopName from HW_GoodsInfo a inner join GoodsSortShop b on a.SortId=b.SortId inner join JC_Shop c on b.ShopId=c.ShopId where GoodsId in (" + ids + ")"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - var dt= db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } #endregion @@ -24127,7 +24132,7 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b Database database = DatabaseFactory.CreateDatabase(); DbCommand sqlStringCommand = database.GetSqlStringCommand(sql); DataTable dt = database.ExecuteDataTable(sqlStringCommand); - if(dt.Rows!=null && dt.Rows.Count > 0) + if (dt.Rows != null && dt.Rows.Count > 0) { return dt.Rows[0]["Code"].ToString(); } @@ -24136,7 +24141,7 @@ b.TotalWeight,b.TotalSoild,b.MoneyType,b.CustomID,b.SKU,b.RevName,b.RevCountry,b #region 返回亚马逊平台个人管理商品的销售数据 - public static List GetAmazonPeopleGoodsSaleDataList(DateTime sDate,DateTime eDate,string userids,int pageIndex,int pageSize,out int rowCount) + public static List GetAmazonPeopleGoodsSaleDataList(DateTime sDate, DateTime eDate, string userids, int pageIndex, int pageSize, out int rowCount) { var sql = @"--管理的所有商品 select GoodsId,GoodsCode,GoodsName into #ls_1 from HW_GoodsInfo where muserid in (" + userids + ") "; @@ -24188,8 +24193,8 @@ inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where a.muserid in (" + useri sql += @" --仓储费 select a.GoodsId,CONVERT(decimal(12,2),SUM(isnull(a.StockSolidNum,0)*0.5)) DayTotalSolidFee into #ls_8 from PeopleDayStockSolid a inner join HW_GoodsInfo b on a.GoodsId=b.GoodsId -where CONVERT(date,a.InDate)>=@sDate and CONVERT(date,a.InDate)<=@eDate and b.muserid in ("+userids+") group by a.GoodsId select count(GoodsId) Count from #ls_1"; - sql+=@" +where CONVERT(date,a.InDate)>=@sDate and CONVERT(date,a.InDate)<=@eDate and b.muserid in (" + userids + ") group by a.GoodsId select count(GoodsId) Count from #ls_1"; + sql += @" select * from ( select row_number() over(order by a2.TotalPrice desc ,a3.AdFee desc) row, a1.GoodsId,a1.GoodsCode,a1.GoodsName, a3.AdFee,a4.OrderCount,a2.TotalPrice,case when ISNULL(a3.AdFee,0)=0 and isnull(a2.TotalPrice,0)=0 then '0' when ISNULL(a3.AdFee,0)=0 then '0' when isnull(a2.TotalPrice,0)=0 then '∞' else convert(nvarchar(10), convert(decimal(12,2),a3.AdFee*100/a2.TotalPrice)) end TCB, case when ISNULL(a3.AdFee,0)=0 and ISNULL(a6.AdTotalPrice,0)=0 then '0' when ISNULL(a3.AdFee,0)=0 then '0' when ISNULL(a6.AdTotalPrice,0)=0 then '∞' else convert(nvarchar(10), convert(decimal(12,2), a3.AdFee*100/a6.AdTotalPrice)) end AdSaleZB, @@ -24211,15 +24216,15 @@ left join #ls_5 a5 on a1.GoodsId=a5.GoodsId left join #ls_6 a6 on a1.GoodsId=a6. #endregion #region 获取亚马逊平台个人管理商品月净利润 - public static List GetAmazonPeopleGoodsMonthHJLR(string userids,DateTime sDate,DateTime eDate) + public static List GetAmazonPeopleGoodsMonthHJLR(string userids, DateTime sDate, DateTime eDate) { var sql = @" select z.OrderId into #ls_4 from DT_OrderInfo z with(nolock) inner join DT_OrderGoods y with(nolock) on z.OrderId=y.OrderId inner join HW_GoodsDetail x with(nolock) on y.DetailId=x.DetailId inner join HW_GoodsInfo w with(nolock) on x.GoodsId=w.GoodsId -where z.State>0 and z.State<3 and PlatId=2 and CONVERT(date,z.OrderDate)>=@sDate and CONVERT(date,z.OrderDate)<=@eDate and w.muserid in (" + userids + ")"; - sql+= @" +where z.State>0 and z.State<3 and PlatId=2 and CONVERT(date,z.OrderDate)>=@sDate and CONVERT(date,z.OrderDate)<=@eDate and w.muserid in (" + userids + ")"; + sql += @" select c.GoodsId ,CONVERT(decimal(12,2), SUM(a.LR)) LR into #ls_1 from ( select f.OrderId, @@ -24897,7 +24902,7 @@ else db.AddInParameter(cmd, "@AdSaleAmount", DbType.Decimal, md.AdSaleAmount); db.ExecuteNonQuery(cmd); } - catch(Exception ex) + catch (Exception ex) { return false; } @@ -24907,7 +24912,7 @@ else #endregion #region 获取店铺商品每天的广告费 - public static List GetShopGoodsAdFeeModel(int shopId,DateTime? sDate,DateTime? eDate,int pageIndex,int pageSize,out int rowCount) + public static List GetShopGoodsAdFeeModel(int shopId, DateTime? sDate, DateTime? eDate, int pageIndex, int pageSize, out int rowCount) { var filt = " where 1=1 "; if (shopId != 0) @@ -24948,14 +24953,14 @@ else Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - var dt=db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } #endregion #region 获取亚马逊平台人员管理商品净利润>0的数量所占的百分比 - public static List GetAmazonPeopleGoodsHJLRPercentList(DateTime sdt,DateTime edt) + public static List GetAmazonPeopleGoodsHJLRPercentList(DateTime sdt, DateTime edt) { var sql = @"--订单利润 select z.OrderId into #ls_4 from DT_OrderInfo z with(nolock) @@ -25317,13 +25322,13 @@ GROUP BY DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@code", DbType.String, code); - var dt=db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.Rows[0].ToModel(); } #endregion #region 新增退货运单号临时记录表(PDA扫描人员使用) - public static bool AddOrderReturnTrackingIdForScan(string code,int? userid,string wareHouse) + public static bool AddOrderReturnTrackingIdForScan(string code, int? userid, string wareHouse) { var sql = @"if(not exists(select 1 from OrderReturnTrackingId where TrackingId=@code)) begin @@ -25339,7 +25344,7 @@ GROUP BY return db.ExecuteNonQuery(cmd) >= 1; } - public static int AddOrderReturnTrackingIdForScanReturnID(string code,string scanCode, int? userid, string wareHouse) + public static int AddOrderReturnTrackingIdForScanReturnID(string code, string scanCode, int? userid, string wareHouse) { var sql = @"if(not exists(select 1 from OrderReturnTrackingId where TrackingId=@code and ScanTrackingId=@scanCode)) begin @@ -25366,7 +25371,7 @@ GROUP BY return 0; } - public static int UploadPhotoOrderReturnTrackingId(int id,string photo) + public static int UploadPhotoOrderReturnTrackingId(int id, string photo) { var sql = @"if(exists(select 1 from OrderReturnTrackingId where ID=@id)) begin @@ -25392,7 +25397,7 @@ GROUP BY return 0; } - public static DT_OrderReturn GetDT_OrderReturnByTrackId(string code,string code2) + public static DT_OrderReturn GetDT_OrderReturnByTrackId(string code, string code2) { var sql = @" select top 1 * from DT_OrderReturn where tracking_id=@code or tracking_id=@code2 "; @@ -25448,7 +25453,7 @@ GROUP BY Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - var ds=db.ExecuteDataSet(cmd); + var ds = db.ExecuteDataSet(cmd); rowCount = (int)ds.Tables[0].Rows[0]["count"]; @@ -25470,14 +25475,14 @@ GROUP BY sql = " Update OrderReturnTrackingId set TrackingId=@TrackingId , OrderCode=@OrderCode,SKU=@SKU,ReturnNum=@ReturnNum,InType=@InType ,WareHouse=@WareHouse where ID=@ID"; } -// var sql = @"if(exists(select 1 from OrderReturnTrackingId where TrackingId=@TrackingId)) -// begin -// Update OrderReturnTrackingId set OrderCode=@OrderCode,SKU=@SKU,ReturnNum=@ReturnNum,InType=@InType ,WareHouse=@WareHouse where TrackingId=@TrackingId -// end -//else -// begin -// insert into OrderReturnTrackingId(TrackingId,OrderCode,SKU,ReturnNum,InType,CreateTime,UserId,WareHouse) Values(@TrackingId,@OrderCode,@SKU,@ReturnNum,@InType,GetDate(),@UserId,@WareHouse) -// end"; + // var sql = @"if(exists(select 1 from OrderReturnTrackingId where TrackingId=@TrackingId)) + // begin + // Update OrderReturnTrackingId set OrderCode=@OrderCode,SKU=@SKU,ReturnNum=@ReturnNum,InType=@InType ,WareHouse=@WareHouse where TrackingId=@TrackingId + // end + //else + // begin + // insert into OrderReturnTrackingId(TrackingId,OrderCode,SKU,ReturnNum,InType,CreateTime,UserId,WareHouse) Values(@TrackingId,@OrderCode,@SKU,@ReturnNum,@InType,GetDate(),@UserId,@WareHouse) + // end"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -25514,7 +25519,7 @@ GROUP BY Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@userid", DbType.Int32, userid); - var dt=db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); if (dt != null && dt.Rows.Count > 0) return dt.Rows[0].ToModel(); @@ -25524,7 +25529,7 @@ GROUP BY #endregion #region 发货检验流程代码 - public static List GetOrderPostInfoDatas(string searchCode, int searchType,string wareHouse, int postState, int printState, DateTime? sDate, DateTime? eDate, int PageSize, int PageIndex,out int rowCount) + public static List GetOrderPostInfoDatas(string searchCode, int searchType, string wareHouse, int postState, int printState, DateTime? sDate, DateTime? eDate, int PageSize, int PageIndex, out int rowCount) { var filt = " where 1=1"; if (!string.IsNullOrEmpty(searchCode)) @@ -25579,7 +25584,7 @@ GROUP BY return ds.Tables[1].ToList(); } - + public static void SaveOrderPostInfo(OrderPostInfo md) { var sql = @" @@ -25630,12 +25635,12 @@ GROUP BY db.ExecuteNonQuery(cmd); } - public static List GetOrderPostInfoListByIds(string ids,string warehouse) + public static List GetOrderPostInfoListByIds(string ids, string warehouse) { var sql = @"select a.ID, a.OrderCode, a.NewSKU,a.SKU,a.Qty, LocationCode from OrderPostInfo a left join CK_StorePostion b on a.LocationCode=b.PostionCode where a.WareHouse='" + warehouse + "' and a.ID in (" + ids + ") order by b.PostionCode,b.SortNo"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - var dt= db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } /// @@ -25736,7 +25741,7 @@ GROUP BY /// /// /// - public static List GetTemuOrderPostInfoDatasBySearch(string wareHouse,DateTime? sDate, DateTime? eDate) + public static List GetTemuOrderPostInfoDatasBySearch(string wareHouse, DateTime? sDate, DateTime? eDate) { var filt = " where b.PlatId=23"; @@ -25769,7 +25774,7 @@ GROUP BY var sql = @" select * from DT_TrackCodeApply where OrderCode=@orderCode and State=1"; Database db = DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@orderCode", DbType.String, orderCode); var dt = db.ExecuteDataTable(cmd); @@ -25792,7 +25797,7 @@ GROUP BY /// 获取托盘数据 /// /// - public static List GetTrayInfoDatas(DateTime? inDate,int userid,int logUserid, string code,string wareHouse,int state,int PageIndex,int PageSize,out int rowCount) + public static List GetTrayInfoDatas(DateTime? inDate, int userid, int logUserid, string code, string wareHouse, int state, int PageIndex, int PageSize, out int rowCount) { var filt = "where 1=1 "; if (inDate.HasValue) @@ -25871,7 +25876,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. db.ExecuteNonQuery(cmd); } - public static List GetTrayInfo(DateTime indate, int userid,string warehouse,int printState) + public static List GetTrayInfo(DateTime indate, int userid, string warehouse, int printState) { var sql = @"select ID,InDate,TrayCode,WareHouse,PrintState,TrayUserId,Sort from TrayInfo where CONVERT(date,InDate)=@InDate and WareHouse=@WareHouse and TrayUserId=@UserId and PrintState=@PrintState order by Sort"; Database db = DatabaseFactory.CreateDatabase(); @@ -25908,7 +25913,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - db.AddInParameter(cmd, "@TrayCode", DbType.String, md.TrayCode); + db.AddInParameter(cmd, "@TrayCode", DbType.String, md.TrayCode); db.AddInParameter(cmd, "@SKU", DbType.String, md.SKU); db.AddInParameter(cmd, "@WareHouse", DbType.String, md.WareHouse); db.AddInParameter(cmd, "@LocationCode", DbType.String, md.LocationCode); @@ -25927,7 +25932,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. /// /// /// - public static List GetUserPickTrayList(int userid,DateTime indate) + public static List GetUserPickTrayList(int userid, DateTime indate) { var sql = @" select a.ID, a.TrayCode,SUM(ISNULL( b.PickQty,0)) PickQty from TrayInfo a inner join TrayPickGoodsInfo b on a.TrayCode=b.TrayCode where CONVERT(date,InDate)=@indate and TrayUserId=@userid group by a.ID,a.TrayCode "; Database db = DatabaseFactory.CreateDatabase(); @@ -25960,7 +25965,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. /// /// - public static List GetPickGoodsInfo(int userid,DateTime InDate) + public static List GetPickGoodsInfo(int userid, DateTime InDate) { var sql = @"select ID,InDate,WareHouse,NewSKU,SKU,PickQty,ScanQty,LocationCode,PickUserId,PackGoodCode,PackGoodCode2 ,ISNULL( b.KCNum,0) KCNum from PickGoodsInfo a left join @@ -26058,7 +26063,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@id", DbType.Int32, id); var dt = db.ExecuteDataTable(cmd); - if(dt!=null && dt.Rows.Count > 0) + if (dt != null && dt.Rows.Count > 0) { return dt.Rows[0].ToModel(); } @@ -26118,7 +26123,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. /// /// /// - public static List GetPickGoodsInfosData(DateTime? inDate, string wareHouse,string SKU,int userid,int PageIndex,int PageSize,out int rowCount) + public static List GetPickGoodsInfosData(DateTime? inDate, string wareHouse, string SKU, int userid, int PageIndex, int PageSize, out int rowCount) { var filt = " where 1=1"; if (inDate.HasValue) @@ -26133,7 +26138,7 @@ select ROW_NUMBER() over(order by a.InDate desc, Sort ) row,a.ID,Convert(date,a. { filt += " and SKU like '%" + SKU + "%'"; } - if (userid>0) + if (userid > 0) { filt += " and a.PickUserId=" + userid; } @@ -26228,9 +26233,9 @@ else var sql = @"select top 1 a.GoodsId,GoodsCode,a.GoodsOldCode,a.BoxRate,b.TypeCode,IsNull( Barcode,'') Barcode from HW_GoodsInfo a inner join HW_GoodsDetail b on a.GoodsId=b.GoodsId where b.SKU1=@sku"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - db.AddInParameter(cmd, "@sku", DbType.String,sku); - var dt=db.ExecuteDataTable(cmd); - if(dt!=null && dt.Rows.Count > 0) + db.AddInParameter(cmd, "@sku", DbType.String, sku); + var dt = db.ExecuteDataTable(cmd); + if (dt != null && dt.Rows.Count > 0) { return dt.Rows[0].ToModel(); } @@ -26243,7 +26248,7 @@ else /// /// /// - public static decimal GetUserPickGoodsTotalSolid(DateTime indate,int userid) + public static decimal GetUserPickGoodsTotalSolid(DateTime indate, int userid) { var sql = @" select Convert(decimal(12,2), ISNULL(SUM(ISNULL(PickQty,0)* ISNULL(c.Solid,0)),0)) TotalSolid from PickGoodsInfo a left join HW_GoodsDetail b on a.SKU=b.SKU1 or a.SKU=b.SKU2 or a.SKU=b.SKU3 or a.SKU=b.SKU4 left join HW_GoodsInfo c on b.GoodsId=c.GoodsId where CONVERT(date,a.InDate)=CONVERT(date,@InDate) and PickUserId=@userid"; Database db = DatabaseFactory.CreateDatabase(); @@ -26258,7 +26263,7 @@ else /// /// /// - public static void TransferPickGoodsInfoDataToUser(string ids,int userid) + public static void TransferPickGoodsInfoDataToUser(string ids, int userid) { var sql = @" update PickGoodsInfo set PickUserId=" + userid + " where ID in (" + ids + ")"; Database db = DatabaseFactory.CreateDatabase(); @@ -26333,24 +26338,24 @@ else public static TrayInfo GetTrayCodeInfo(string trayCode) { var sql = @" select top 1 * from TrayInfo where TrayCode=@trayCode "; - Database db = DatabaseFactory.CreateDatabase(); - DbCommand cmd = db.GetSqlStringCommand(sql); - db.AddInParameter(cmd, "@trayCode", DbType.String, trayCode); + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(sql); + db.AddInParameter(cmd, "@trayCode", DbType.String, trayCode); - var dt = db.ExecuteDataTable(cmd); - if (dt != null && dt.Rows.Count > 0) - { - return dt.Rows[0].ToModel(); - } - else - return null; + var dt = db.ExecuteDataTable(cmd); + if (dt != null && dt.Rows.Count > 0) + { + return dt.Rows[0].ToModel(); + } + else + return null; } /// /// 根据商品匹配订单和未打印的跟踪码 /// /// - public static MatchTrackingCodeModel MatchGoodsTrackingCode(string filt,string wareHouse,DateTime nowDate) + public static MatchTrackingCodeModel MatchGoodsTrackingCode(string filt, string wareHouse, DateTime nowDate) { var sql = @" select top 1 a.ID OrderPostInfoID,a.OrderCode,a.Qty PickQty,a.PostQty ,b.Id TrackCodeApplyID,b.PostId,c.Name ExpressName, b.TrackCode,b.OrderId,b.LabelUrl,b.SKU as QtySKU from OrderPostInfo a inner join DT_TrackCodeApply b on a.OrderCode=b.OrderCode inner join JC_Express c on b.PostId=c.ExpressID where Convert(date,a.PostDate)='" + nowDate.Date + "' and a.PrintState=1 and b.State=1 and IsNull(b.LabelUrl,'')<>'' and IsNull(b.TrackPrintState,0)=0 and a.WareHouse='" + wareHouse + "' " + filt + " order by a.PostDate desc,b.[GetDate] desc"; @@ -26359,7 +26364,7 @@ else Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); - var dt= db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); if (dt != null && dt.Rows.Count > 0) { return dt.Rows[0].ToModel(); @@ -26372,7 +26377,7 @@ else /// 查询推荐可能想要匹配的跟踪码 /// /// - public static List MatchGoodsTrackingCodeTJ(string filt,string wareHouse,DateTime nowDate) + public static List MatchGoodsTrackingCodeTJ(string filt, string wareHouse, DateTime nowDate) { var sql = @"select b.TrackCode,b.SKU as QtySKU from OrderPostInfo a inner join DT_TrackCodeApply b on a.OrderCode=b.OrderCode inner join JC_Express c on b.PostId=c.ExpressID where Convert(date,a.PostDate)='" + nowDate.Date + "' and a.PrintState=1 and b.State=1 and IsNull(b.TrackPrintState,0)=0 and a.WareHouse='" + wareHouse + "' " + filt + " group by b.TrackCode,b.SKU"; @@ -26433,7 +26438,7 @@ else /// /// /// - public static List GetOrderPostInfoDatasForPrint(string orderCode,string sku) + public static List GetOrderPostInfoDatasForPrint(string orderCode, string sku) { var sql = @"select * from OrderPostInfo where OrderCode=@OrderCode and SKU=@SKU and Qty>ISNULL(PostQty,0) order by PostDate desc"; Database db = DatabaseFactory.CreateDatabase(); @@ -26478,7 +26483,7 @@ update DT_TrackCodeApply set TrackPrintState=1 where TrackCode in ( select a.Son /// 获取仓库库位拣货人数据 /// /// - public static List GetPositionPickerDatas(string wareHouse,int PageIndex, int PageSize, out int rowCount) + public static List GetPositionPickerDatas(string wareHouse, int PageIndex, int PageSize, out int rowCount) { var filt = "where 1=1 "; if (!string.IsNullOrEmpty(wareHouse)) @@ -26616,7 +26621,7 @@ select ROW_NUMBER() over(order by a.ID desc) row ,a.ID,a.WareHouse,a.PickType,a. /// /// /// - public static void UpdateTrackCodeImage(string trackCode,string labelUrl) + public static void UpdateTrackCodeImage(string trackCode, string labelUrl) { var sql = @" update DT_TrackCodeApply set LabelUrl=@LabelUrl where State=1 and (TrackCode=@trackCode or TrackCode2=@trackCode)"; @@ -26688,7 +26693,7 @@ end /// /// /// - public static List GetDT_OrderReturnDatas(string code1 ,string code2) + public static List GetDT_OrderReturnDatas(string code1, string code2) { string sql = @"select * from DT_OrderReturn where tracking_id=@code1 or tracking_id=@code2"; Database db = DatabaseFactory.CreateDatabase(); @@ -26767,7 +26772,7 @@ end /// /// /// - public static List GetOrderReturnBarcodeList(string search ,int searchType,int printState,int PageIndex,int PageSize,out int rowCount) + public static List GetOrderReturnBarcodeList(string search, int searchType, int printState, int PageIndex, int PageSize, out int rowCount) { string filt = " where 1=1 "; if (!string.IsNullOrEmpty(search)) @@ -26843,7 +26848,7 @@ end db.ExecuteNonQuery(cmd); } - public static void UpdateTrackingCodeSKU(int id,string sku) + public static void UpdateTrackingCodeSKU(int id, string sku) { var sql = @" update DT_TrackCodeApply set SKU=@sku where Id=@ID"; Database db = DatabaseFactory.CreateDatabase(); @@ -26953,7 +26958,7 @@ end /// /// /// - public static void SetOrderPostFeeEstimatesBestByID(int id,int orderid) + public static void SetOrderPostFeeEstimatesBestByID(int id, int orderid) { var sql = "update OrderPostFeeEstimate set IsBest=0 where OrderId=@orderid\r\nupdate OrderPostFeeEstimate set IsBest=1 where ID=@id"; Database db = DatabaseFactory.CreateDatabase(); @@ -27261,13 +27266,13 @@ inner join CK_StoreHouse c on a.StoreId=c.StoreId #region 统计发货面单 - public static List GetCountListLabels(string WareHouse,DateTime? SDate, DateTime? EDate,int TrackPrintState) + public static List GetCountListLabels(string WareHouse, DateTime? SDate, DateTime? EDate, int TrackPrintState) { string tsql = ""; List list = null; - - tsql = @" + + tsql = @" select PostDate=CONVERT(varchar(10),PostDate, 120),num=COUNT(0) from DT_TrackCodeApply a inner join ( select OrderCode,PostDate=MAX(PostDate) from OrderPostInfo a @@ -27279,7 +27284,7 @@ group by CONVERT(varchar(10),PostDate, 120) "; - + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@WareHouse", DbType.String, WareHouse); @@ -27294,7 +27299,7 @@ group by CONVERT(varchar(10),PostDate, 120) #region 快递跟踪码关联表 - public static List GetTrackCodeRelations(string code,int pageIndex,int pageSize,out int rowCount) + public static List GetTrackCodeRelations(string code, int pageIndex, int pageSize, out int rowCount) { var filt = " where 1=1"; if (!string.IsNullOrEmpty(code)) @@ -27304,8 +27309,8 @@ group by CONVERT(varchar(10),PostDate, 120) var sql = @"select COUNT(*) count from TrackCodeRelation " + filt; sql += " select * from (\r\nselect ROW_NUMBER() over(order by id desc) row,ID,MainTrackCode,SonTrackCode,CreateTime from TrackCodeRelation " + filt + "\r\n) t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + (pageIndex * pageSize); - var db= DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(sql); var dt = db.ExecuteDataSet(cmd); rowCount = Convert.ToInt32(dt.Tables[0].Rows[0]["count"]); return dt.Tables[1].ToList(); @@ -27357,7 +27362,7 @@ where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.Or ) t group by t.StoreId,t.DetailId "; var db = DatabaseFactory.CreateDatabase(); - var cmd=db.GetSqlStringCommand(sql); + var cmd = db.GetSqlStringCommand(sql); return db.ExecuteDataTable(cmd).ToList(); } @@ -27383,7 +27388,7 @@ where a.State>0 and c.StoreId in (6,9,11) and a.State<3 and DATEDIFF(day,a.Or } - + Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(sql); @@ -27632,7 +27637,7 @@ INNER JOIN ( #region 获取每天东西部未打印面单数据 - public static List GetWareHouseNoPrintedDatas(string warehouse,DateTime date) + public static List GetWareHouseNoPrintedDatas(string warehouse, DateTime date) { var filt = " b.State=1 and ISNULL(b.TrackPrintState,0)=0 and Convert(date, PostDate)=convert(date,'" + date.Date + "') "; if (!string.IsNullOrEmpty(warehouse)) @@ -27640,7 +27645,7 @@ INNER JOIN ( filt += " and WareHouse='" + warehouse + "'"; } var sql = @"select distinct a.WareHouse, b.TrackCode, b.SKU from OrderPostInfo a left join DT_TrackCodeApply b on a.OrderCode=b.OrderCode where " + filt; - var db= DatabaseFactory.CreateDatabase(); + var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); //db.AddInParameter(cmd, "wareHouse", DbType.String, warehouse); @@ -27680,11 +27685,11 @@ end "; #region 保存产品补贴价格 - public static void SaveGoodsBTPrice(int goodsid,decimal? price) + public static void SaveGoodsBTPrice(int goodsid, decimal? price) { var sql = @"update HW_GoodsInfo set SubsidyFee=@price where GoodsId=@goodsid"; var db = DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@goodsid", DbType.Int32, goodsid); db.AddInParameter(cmd, "@price", DbType.Decimal, price); db.ExecuteNonQuery(cmd); @@ -27694,7 +27699,7 @@ end "; #region 刷新产品的订单补贴价格 - public static void UpdateOrderBTPrice(int goodsid,int platid) + public static void UpdateOrderBTPrice(int goodsid, int platid) { var sql = @"update a set a.SubsidyFee=b.BTPrice from DT_Fees a inner join (select a.OrderId,SUM(b.GoodsNum*ISNULL(d.SubsidyFee,0)) BTPrice from DT_OrderInfo a inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail c on b.DetailId=c.DetailId inner join HW_GoodsInfo d on c.GoodsId=d.GoodsId where a.OrderId in (select a.OrderId from DT_OrderInfo a inner join DT_OrderGoods b on a.OrderId=b.OrderId inner join HW_GoodsDetail c on b.DetailId=c.DetailId inner join HW_GoodsInfo d on c.GoodsId=d.GoodsId where CONVERT(date,a.indate)>='2024-04-01' and CONVERT(date,a.indate)<='2024-07-31' and d.GoodsId=@goodsid and a.platid=@platid) group by a.OrderId ) b on a.orderid=b.OrderId"; var db = DatabaseFactory.CreateDatabase(); @@ -27752,7 +27757,7 @@ select @Id"; resultId = Convert.ToInt32(db.ExecuteScalar(cmd)); } - catch(Exception ex) + catch (Exception ex) { resultId = -1; } @@ -27829,7 +27834,7 @@ select @Id"; //ser.Sort = Sort; //ser.KeyName = "Id"; //string tsql = ser.GetText(); - string tsql = string.IsNullOrEmpty(whereMsg) ? $"select {FieldsMsg} from {TablesMsg} order by {Sort}".Replace("desc", "") : $"select {FieldsMsg} from {TablesMsg} where {whereMsg} order by {Sort}".Replace("desc",""); + string tsql = string.IsNullOrEmpty(whereMsg) ? $"select {FieldsMsg} from {TablesMsg} order by {Sort}".Replace("desc", "") : $"select {FieldsMsg} from {TablesMsg} where {whereMsg} order by {Sort}".Replace("desc", ""); List ListModel = new List(); Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); @@ -27877,7 +27882,7 @@ select @Id"; object result = db.ExecuteScalar(cmd); resultId = (int)Model.Id; } - + return resultId; } @@ -27917,7 +27922,7 @@ select @Id"; db.AddInParameter(cmd, "@FactoryName", DbType.String, Model.FactoryName); db.AddInParameter(cmd, "@FactoryImg", DbType.String, Model.FactoryImg); resultId = Convert.ToInt32(db.ExecuteScalar(cmd)); - + } catch { @@ -27935,7 +27940,7 @@ select @Id"; int a = Convert.ToInt32(result); return a; } - public static int Check_DT_QuoteAuthority(int QuoteId, int ClientId) + public static int Check_DT_QuoteAuthority(int QuoteId, int ClientId) { string tsql = $"SELECT count(1) from DT_QuoteAuthority where QuoteId = {QuoteId} and ClientId = {ClientId}"; Database db = DatabaseFactory.CreateDatabase(); @@ -28080,7 +28085,7 @@ select @Id"; public static List GetListDT_QuoteNewById(List ClientIds) { var sql = $"SELECT a.Cantidad,a.Valor,a.ClientId,c.ClientName,b.* FROM [dbo].[DT_QuoteClientNum] a INNER JOIN DT_Quote b on a.QuoteId = b.Id INNER JOIN JC_Client c on a.ClientId = c.Id "; - if (ClientIds.Count() > 0 ) + if (ClientIds.Count() > 0) { sql += " where a.ClientId in ('{string.Join(\"','\", ClientIds)}')"; } @@ -28165,7 +28170,7 @@ select @Id"; // 假设 QuoteId 是字符串类型 if (row["QuoteId"] != DBNull.Value) { - quoteIds.Add( int.Parse(row["QuoteId"].ToString())); + quoteIds.Add(int.Parse(row["QuoteId"].ToString())); } } } @@ -28206,7 +28211,7 @@ select @Id"; { string tsql = $"INSERT INTO JC_Client(ClientName,UserName,Password,State,Authority,CreateId,CreateDate ) VALUES ('{Model.ClientName}','{Model.UserName}','{Model.Password}',{Convert.ToInt32(Model.State)},{(int)Model.Authority},{Model.CreateId},'{Model.CreateDate}');"; Database db = DatabaseFactory.CreateDatabase(); - DbCommand cmd = db.GetSqlStringCommand(tsql); + DbCommand cmd = db.GetSqlStringCommand(tsql); int a = Convert.ToInt32(db.ExecuteScalar(cmd)); return a; } @@ -28270,7 +28275,7 @@ select @Id"; } #endregion #region 保存意向报价单数据 - public static int Save_DT_QuoteClientNum(DT_QuoteClientNum Model,bool isInsert) + public static int Save_DT_QuoteClientNum(DT_QuoteClientNum Model, bool isInsert) { string tsql = ""; if (isInsert) @@ -28289,7 +28294,7 @@ select @Id"; } #endregion #region 客户修改密码 - public static int UpdateClientPassword(int ClientId,string NewPassword) + public static int UpdateClientPassword(int ClientId, string NewPassword) { string tsql = $"UPDATE JC_Client set Password = '{NewPassword}' where Id = {ClientId};"; Database db = DatabaseFactory.CreateDatabase(); @@ -28302,7 +28307,7 @@ select @Id"; #region 删除意向报价单数据 public static int Delete_DT_QuoteClientNum(List Ids) { - if (Ids.Count>0) + if (Ids.Count > 0) { string tsql = $"DELETE DT_QuoteClientNum where id in ({string.Join(",", Ids)});"; Database db = DatabaseFactory.CreateDatabase(); @@ -28357,12 +28362,12 @@ select @Id"; #region - public static List GetTemuShopGoodPriceList(int shopid,string sku,int pageIndex,int pageSize,out int rowCount) + public static List GetTemuShopGoodPriceList(int shopid, string sku, int pageIndex, int pageSize, out int rowCount) { var filt = " where 1=1 "; if (shopid > 0) { - filt += " and a.Shopid=@shopid" ; + filt += " and a.Shopid=@shopid"; } if (!string.IsNullOrEmpty(sku)) { @@ -28374,8 +28379,8 @@ select @Id"; select t.ID,t.Shopid,t.ShopName,t.SPUID,t.SKU,t.SalePrice,t.CreateUserId,t.PostPrice from ( select ROW_NUMBER() over(order by a.id desc) row, a.*,b.ShopName from TemuShopGoodPrice a inner join JC_Shop b on a.Shopid=b.ShopId" + filt + ") t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; - var db=DatabaseFactory.CreateDatabase(); - var cmd=db.GetSqlStringCommand(sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@shopid", DbType.Int32, shopid); var ds = db.ExecuteDataSet(cmd); @@ -28420,7 +28425,7 @@ end"; var sql = @" delete from TemuShopGoodPrice where id=@id"; var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); - db.AddInParameter(cmd, "@id", DbType.Int32,id); + db.AddInParameter(cmd, "@id", DbType.Int32, id); db.ExecuteNonQuery(cmd); } @@ -28428,7 +28433,7 @@ end"; #endregion - public static List GetTemuShopGoodPrice(int shopid,string sku,string spuid) + public static List GetTemuShopGoodPrice(int shopid, string sku, string spuid) { var sql = @" select * from TemuShopGoodPrice where Shopid=@shopid and sku=@sku and spuid=@spuid "; @@ -28449,7 +28454,7 @@ end"; db.AddInParameter(cmd, "@shopid", DbType.Int32, shopid); db.AddInParameter(cmd, "@spuid", DbType.String, spuid); var dt = db.ExecuteDataTable(cmd); - if(dt!=null && dt.Rows.Count > 0) + if (dt != null && dt.Rows.Count > 0) { return dt.Rows[0].ToModel(); } @@ -28475,18 +28480,18 @@ end"; #region TEMU商品价格审核 - public static List GetTemuShopGoodPriceChecks(int shopid,string sku,int? state, int pageIndex,int pageSize,out int rowCount) + public static List GetTemuShopGoodPriceChecks(int shopid, string sku, int? state, int pageIndex, int pageSize, out int rowCount) { var filt = " where 1=1 "; if (shopid > 0) { - filt += " and a.shopid= "+shopid; + filt += " and a.shopid= " + shopid; } if (!string.IsNullOrEmpty(sku)) { filt += " and (a.sku like '%" + sku + "%' or a.SPUID like '%" + sku + "%')"; } - if(state.HasValue && state.Value>=0) + if (state.HasValue && state.Value >= 0) { filt += " and a.state= " + state.Value; } @@ -28494,8 +28499,8 @@ end"; sql += @"select * from ( select ROW_NUMBER() over(order by a.id desc) row,a.*,b.ShopName,c.UserName CreateUserName,d.UserName CheckUserName,e.GoodsId,f.InPrice,f.FeeRate,f.Solid from TemuShopGoodPriceCheck a inner join JC_Shop b on a.Shopid=b.ShopId left join HW_GoodsDetail e on a.SKU=e.SKU1 left join HW_GoodsInfo f on e.GoodsId=f.GoodsId left join JC_UserInfo c on a.CreateUserId=c.UserId left join JC_UserInfo d on a.CheckUserId=d.UserId " + filt + " ) t where t.row between " + ((pageIndex - 1) * pageSize + 1) + " and " + pageIndex * pageSize; - var db=DatabaseFactory.CreateDatabase(); - var cmd=db.GetSqlStringCommand(sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(sql); var ds = db.ExecuteDataSet(cmd); rowCount = (Int32)ds.Tables[0].Rows[0]["count"]; @@ -28587,12 +28592,12 @@ end"; var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@shopid", DbType.Int32, shopid); - var dt=db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } - public static void CheckTemuShopGoodPrice(int id,int userid,int state) + public static void CheckTemuShopGoodPrice(int id, int userid, int state) { var sql = @" update TemuShopGoodPriceCheck set State=@state ,CheckUserId=@userid ,CheckTime=GETDATE() where State=0 and id=@id @@ -28670,7 +28675,7 @@ end var sql = @" insert into TemuShopOrderGoodsDetail(Shopid,ParentOrderSn,OrderSn,OrderStatus,GoodsId,SKUId,ThumbUrl,Quantity,GoodsName,ProductList,CreateTime) values(@Shopid,@ParentOrderSn,@OrderSn,@OrderStatus,@GoodsId,@SKUId,@ThumbUrl,@Quantity,@GoodsName,@ProductList,GETDATE()) "; var db = DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@Shopid", DbType.Int32, md.Shopid); db.AddInParameter(cmd, "@ParentOrderSn", DbType.String, md.ParentOrderSn); db.AddInParameter(cmd, "@OrderSn", DbType.String, md.OrderSn); @@ -28701,7 +28706,7 @@ end { var sql = @"select * from TemuShopOrderGoodsDetail where ParentOrderSn=@ParentOrderSn"; var db = DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@ParentOrderSn", DbType.String, parentOrderSn); var dt = db.ExecuteDataTable(cmd); @@ -28715,21 +28720,21 @@ end var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); - var dt= db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } - public static HW_GoodsDetail GetHW_GoodsDetailByTemuSKUid( int orderid, string goodsid,string skuid) + public static HW_GoodsDetail GetHW_GoodsDetailByTemuSKUid(int orderid, string goodsid, string skuid) { var sql = @" select top 1 b.* from DT_OrderGoods a inner join HW_GoodsDetail b on a.DetailId=b.DetailId where OrderId=@orderid and GoodsName like '%" + goodsid + "%' and GoodsName like '%" + skuid + "%'"; var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@orderid", DbType.Int32, orderid); - var dt=db.ExecuteDataTable(cmd); - if (dt != null && dt.Rows!=null && dt.Rows.Count > 0) + var dt = db.ExecuteDataTable(cmd); + if (dt != null && dt.Rows != null && dt.Rows.Count > 0) return dt.Rows[0].ToModel(); return null; } @@ -28741,8 +28746,8 @@ end begin insert into TemuOrderShipPackageSn(OrderId,OrderCode,PackageSn,CreateTime) values(@orderid,@orderCode,@packageSn,GETDATE()) end"; - var db= DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@orderid", DbType.Int32, md.OrderId); db.AddInParameter(cmd, "@orderCode", DbType.String, md.OrderCode); db.AddInParameter(cmd, "@packageSn", DbType.String, md.PackageSn); @@ -28755,10 +28760,10 @@ end { var sql = @" select * from TemuOrderShipPackageSn where OrderId=@orderid "; - var db= DatabaseFactory.CreateDatabase(); - var cmd=db.GetSqlStringCommand(sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@orderid", DbType.Int32, orderid); - var dt= db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } @@ -28769,9 +28774,9 @@ end public static List GetTemuTrackCodeFileDatas(string orderCode) { var sql = @"select a.OrderId,a.OrderCode,b.TrackCode, b.LabelUrl,b.SKU, b.PostId,c.Name ExpressName from DT_OrderInfo a inner join DT_TrackCodeApply b on a.OrderId=b.OrderId inner join JC_Express c on b.PostId=c.ExpressID where a.OrderCode='" + orderCode + "' and b.State=1"; - var db= DatabaseFactory.CreateDatabase(); + var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); - var dt=db.ExecuteDataTable(cmd); + var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } #endregion @@ -28985,7 +28990,7 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= #region 执行存储过程,把ERP订单转到WMS - public static void SyncERPOrderToWMS(DateTime sDate,DateTime eDate) + public static void SyncERPOrderToWMS(DateTime sDate, DateTime eDate) { Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("SyncOrdersToWMS"); @@ -28999,7 +29004,7 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= #region 根据订单号修改订单运费 - public static int UpdateDT_FeeYFByOrderCode(string orderCode,decimal fee) + public static int UpdateDT_FeeYFByOrderCode(string orderCode, decimal fee) { //var sql = @"update a set a.yf=@fee from DT_Fees a with (nolock) inner join DT_OrderInfo b with (nolock) on a.orderid=b.OrderId where b.OrderCode=@orderCode"; @@ -29020,7 +29025,7 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@fee", DbType.Decimal, fee); db.AddInParameter(cmd, "@orderCode", DbType.String, orderCode); - int a= (Int32)db.ExecuteScalar(cmd); + int a = (Int32)db.ExecuteScalar(cmd); return a; } #endregion @@ -29105,7 +29110,7 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= db.AddInParameter(cmd, "@GoodsCode", DbType.String, goodsCode); var dt = db.ExecuteDataTable(cmd); GoodsId = Convert.ToInt32(dt.Rows[0]["GoodsId"]); - + } catch { @@ -29126,7 +29131,7 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= var cmd = db.GetSqlStringCommand(sql); var dt = db.ExecuteDataTable(cmd); GoodsId = Convert.ToDecimal(dt.Rows[0]["QuantityPrice"]); - + } catch { @@ -29141,13 +29146,13 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= try { var sql = @" SELECT SUM(a.Quantity*b.ApplyPrice) as QuantityPrice FROM CK_GoodsApply a LEFT JOIN CK_GoodsApplyPrice b on a.GoodsId = b.GoodsId"; - if (YYUserIdList.Count() >= 0 ) + if (YYUserIdList.Count() >= 0) sql += $" where a.UserId in ({string.Join(",", YYUserIdList)})"; var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); var dt = db.ExecuteDataTable(cmd); GoodsId = Convert.ToDecimal(dt.Rows[0]["QuantityPrice"]); - + } catch { @@ -29166,7 +29171,7 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= var cmd = db.GetSqlStringCommand(sql); var dt = db.ExecuteDataTable(cmd); ApplyPrice = Convert.ToDecimal(dt.Rows[0]["ApplyPrice"]); - + } catch { @@ -29188,8 +29193,8 @@ update [DT_OrderReturn] set SecondHandSalePrice=@SecondHandSalePrice,isOfferUp= { ApplyPrice = Convert.ToInt32(dt.Rows[0]["isGroupLeader"]); } - - + + } catch { @@ -29247,7 +29252,7 @@ select @Id"; db.AddInParameter(cmd, "@AllFreight", DbType.Decimal, Model.AllFreight); db.AddInParameter(cmd, "@FeeRate", DbType.Decimal, Model.FeeRate); db.AddInParameter(cmd, "@TaxesPrice", DbType.Decimal, Model.TaxesPrice); - int a = Convert.ToInt32(db.ExecuteScalar(cmd)); + int a = Convert.ToInt32(db.ExecuteScalar(cmd)); return a; } public static CK_GoodsApplyPrice GetModel_CK_GoodsApplyPriceByGoodsId(int GoodsId) @@ -29279,7 +29284,7 @@ LEFT JOIN HW_GoodsDetail b on a.DetailId = b.DetailId LEFT JOIN JC_UserInfo c on a.UserId = c.UserId "; - + ser.Filter = where.GetWhere(System.Data.CommandType.Text); ser.PageIndex = PageIndex; ser.PageSize = PageSize; @@ -29327,7 +29332,7 @@ LEFT JOIN JC_UserInfo c on a.UserId = c.UserId var dt = db.ExecuteDataTable(cmd); if (dt != null && dt.Rows.Count > 0) { - model= dt.Rows[0].ToModel(); + model = dt.Rows[0].ToModel(); } return model; } @@ -29344,7 +29349,7 @@ LEFT JOIN JC_UserInfo c on a.UserId = c.UserId var dt = db.ExecuteDataTable(cmd); if (dt != null && dt.Rows.Count > 0) { - model= dt.ToList(); + model = dt.ToList(); } return model; } @@ -29379,7 +29384,7 @@ LEFT JOIN CK_GoodsApplyPrice d on d.GoodsId = b.GoodsId sql = @" SELECT a.UserId,ISNULL(SUM(b.Quantity), 0) AS AllQuantity,ISNULL(SUM(b.Quantity*c.ApplyPrice),0) as QuantityPrice from ( SELECT DISTINCT UserId from JC_YYUserInfo) a LEFT JOIN CK_GoodsApply b on a.UserId = b.UserId LEFT JOIN CK_GoodsApplyPrice c on c.GoodsId = b.GoodsId where a.UserId=@UserId GROUP BY a.UserId "; } - + var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); @@ -29396,11 +29401,11 @@ LEFT JOIN CK_GoodsApplyPrice d on d.GoodsId = b.GoodsId { List ListModel = new List(); var sql = @"SELECT a.UserId,ISNULL(SUM(b.Quantity), 0) AS AllQuantity,ISNULL(SUM(b.Quantity*c.ApplyPrice),0) as QuantityPrice from JC_YYUserInfo a LEFT JOIN CK_GoodsApply b on a.UserId = b.UserId LEFT JOIN CK_GoodsApplyPrice c on c.GoodsId = b.GoodsId GROUP BY a.UserId "; - if (UserIdList.Count() >=0) + if (UserIdList.Count() >= 0) { sql = $" SELECT a.UserId,ISNULL(SUM(b.Quantity), 0) AS AllQuantity,ISNULL(SUM(b.Quantity*c.ApplyPrice),0) as QuantityPrice from JC_YYUserInfo a LEFT JOIN CK_GoodsApply b on a.UserId = b.UserId LEFT JOIN CK_GoodsApplyPrice c on c.GoodsId = b.GoodsId where a.UserId in ({string.Join(",", UserIdList)}) GROUP BY a.UserId "; } - + var db = DatabaseFactory.CreateDatabase(); var cmd = db.GetSqlStringCommand(sql); @@ -29429,7 +29434,7 @@ LEFT JOIN JC_UserInfo c on a.UserId = c.UserId var dt = db.ExecuteDataTable(cmd); if (dt != null && dt.Rows.Count > 0) { - model= dt.Rows[0].ToModel(); + model = dt.Rows[0].ToModel(); } return model; } @@ -29444,7 +29449,7 @@ LEFT JOIN JC_UserInfo c on a.UserId = c.UserId var dt = db.ExecuteDataTable(cmd); if (dt != null && dt.Rows.Count > 0) { - model= dt.Rows[0].ToModel(); + model = dt.Rows[0].ToModel(); } return model; } @@ -29494,7 +29499,7 @@ EXEC sp_executesql @query "; } #endregion #region 运营人员 - public static List GetList_YYUser(string where ) + public static List GetList_YYUser(string where) { string tsql = @"SELECT DISTINCT a.UserId as ID,a.Name from @@ -29514,7 +29519,7 @@ JC_YYUserInfo b on a.UserId = b.UserId } #endregion #region 汇总查询 - public static List GetListHW_GoodsInfoNewForApplySku(string yySqlStr,int CompanyId, string SKU, int IsDH, int IsBH, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) + public static List GetListHW_GoodsInfoNewForApplySku(string yySqlStr, int CompanyId, string SKU, int IsDH, int IsBH, RefParameterCollection where, int PageIndex, int PageSize, string Sort, out int RowCount) { string tsql1 = @" @@ -29575,7 +29580,7 @@ and (a.TypeCode LIKE '%" + templist[1] + @"%' OR a.TypeDesc LIKE '%" + templist[ ListModel = tb.ToList(); return ListModel; } - public static List GetAllListCK_GoodsInfoNew(int CompanyId,List gooodsIdList) + public static List GetAllListCK_GoodsInfoNew(int CompanyId, List gooodsIdList) { string tsql = @"select GoodsId=cast(a.GoodsId as int),a.GoodsCode,a.GoodsEg,a.GoodsNo,a.GoodsOldCode,a.SortId,a.SortName,a.SupplierId,a.GoodsName,a.GoodsEnglisgName,b.GoodsNum,GoodsOutNum=isnull(b.GoodsNum,0)+isnull(b.GoodsInNum2,0),GoodsInNum2=isnull(b.GoodsInNum2,0),b.GoodsInNum,b.GoodsHJNum2,b.GoodsHJNum3,b.GoodsHJNum4,a.InPrice,a.NowPrice,a.Weight,a.WeightUnit,a.Solid,a.SolidUnit,a.Position,a.InDate,a.UpdateDate,a.FirstImgUrl,a.GoodsImageIds,a.CompanyId,a.GoodsPlanNum,b.GoodsHJNum,a.SafeNum,a.HGCode,a.HGCompanyCode,a.UpdateName,a.GoodsRemark,a.AutoPlan,a.NoGoods,a.AvgTime,a.State,NoGoodsState=case when a.NoGoods=1 then '是' else '否' end,a.Cert,a.UpOff,NoticeDays=case when b.GoodsHJNum2-isnull(b.GoodsNum,0)-isnull(b.GoodsInNum2,0)>0 then b.GoodsHJNum2/3 else 0 end,GoodsInNum3=isnull(b.GoodsInNum,0),IsNull(a.IsYC,0) IsYC,Case when IsNull(a.IsYC,0)=0 then '隐藏' else '显示' end YCXS,a.FeeRate "; @@ -29589,7 +29594,7 @@ inner join HW_GoodsInfo a with(nolock) on a.GoodsId=b.GoodsId "; { tsql += @"where a.CompanyId=@CompanyId and a.State =1 ORDER BY a.GoodsId DESC "; } - + List ListModel = null; Database db = DatabaseFactory.CreateDatabase(); @@ -29707,8 +29712,8 @@ inner join HW_GoodsInfo a with(nolock) on a.GoodsId=b.GoodsId "; "; - var db= DatabaseFactory.CreateDatabase(); - var cmd= db.GetSqlStringCommand(sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@OrderId", DbType.Int32, md.OrderId); db.AddInParameter(cmd, "@WareHouseId", DbType.String, md.WareHouseId); @@ -29941,7 +29946,7 @@ and hgd.GoodsID in (select GoodsID from HW_GoodsInfo where " + sMsg.Value + @" = /// 查询时间 /// 查询人 /// - public static BB_MRJL_Adfee MRJL_GetGKFeeByMouth(DateTime sDate,DateTime eDate, int plat, int shopid, List goodsIds) + public static BB_MRJL_Adfee MRJL_GetGKFeeByMouth(DateTime sDate, DateTime eDate, int plat, int shopid, List goodsIds) { //返回数据 BB_MRJL_Adfee model = new BB_MRJL_Adfee(); @@ -29998,13 +30003,13 @@ GROUP BY shopid"; /// 查询时间 /// 查询人 /// - public static List MRJL_GetUserListByDay(DateTime sDate,DateTime eDate,int platid) + public static List MRJL_GetUserListByDay(DateTime sDate, DateTime eDate, int platid) { //返回数据 List ListModel = new List(); //店铺数据记录 Dictionary shopMsg = new Dictionary(); - string tsql = @"select oi.*,hgd.GoodsID,InPrice =fee.cb,ckfee = fee.ck,mdfee = fee.md,yf = fee.yf,LR=isnull(isnull(TotalPrice, 0) - isnull(escrowFee, 0) - isnull(yj, 0) - isnull(yf, 0) - ((isnull(cb, 0) + isnull(hwsf, 0)) / moneyrate) - isnull(tc, 0) - isnull(ck, 0) - isnull(md, 0) - isnull(Ad_Fee, 0) + SubsidyFee,0) + string tsql = @"select oi.*,hgd.GoodsID,InPrice =fee.cb,ckfee = fee.ck,mdfee = fee.md,yf = fee.yf,LR=isnull(isnull(TotalPrice, 0) - isnull(escrowFee, 0) - isnull(yj, 0) - isnull(yf, 0) - ((isnull(cb, 0) + isnull(hwsf, 0)) / moneyrate) - isnull(tc, 0) - isnull(ck, 0) - isnull(md, 0) - isnull(Ad_Fee, 0) + SubsidyFee,0) from DT_OrderInfo oi with(nolock) left join DT_OrderGoods og with(nolock) on oi.OrderId=og.OrderId left join HW_GoodsDetail hgd with(nolock) on hgd.DetailId=og.DetailId @@ -30012,25 +30017,25 @@ left join DT_Fees fee with(nolock) on oi.OrderId = fee.orderid where CONVERT(date, oi.OrderDate) <= @eDate and CONVERT(date, oi.OrderDate) >=@sDate"; - if (platid !=0) + if (platid != 0) { tsql += " and oi.platid =@platid"; } - Database db = DatabaseFactory.CreateDatabase(); - DbCommand cmd = db.GetSqlStringCommand(tsql); - db.AddInParameter(cmd, "@sDate", DbType.Date, sDate.Date); - db.AddInParameter(cmd, "@eDate", DbType.Date, eDate.Date); + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + db.AddInParameter(cmd, "@sDate", DbType.Date, sDate.Date); + db.AddInParameter(cmd, "@eDate", DbType.Date, eDate.Date); if (platid != 0) { db.AddInParameter(cmd, "@platid", DbType.Int32, platid); } DataTable tb = db.ExecuteDataTable(cmd); - var list = tb.ToList(); - if (list != null && list.Count() > 0) - { - ListModel.AddRange(list); - } - + var list = tb.ToList(); + if (list != null && list.Count() > 0) + { + ListModel.AddRange(list); + } + return ListModel; } #endregion @@ -30042,7 +30047,7 @@ and CONVERT(date, oi.OrderDate) >=@sDate"; /// 查询时间 /// 查询人 /// - public static int MRJL_GetUsrIdByGoods( int goodsID,string SelectValue) + public static int MRJL_GetUsrIdByGoods(int goodsID, string SelectValue) { //返回数据 int userId = 0; @@ -30069,7 +30074,7 @@ and CONVERT(date, oi.OrderDate) >=@sDate"; /// 查询时间 /// 查询人 /// - public static int MRJL_GetSkuNumByUserid( int Userid) + public static int MRJL_GetSkuNumByUserid(int Userid) { //返回数据 int userId = 0; @@ -30108,7 +30113,7 @@ or guserid_tiktok = @userid"; /// 查询时间 /// 查询人 /// - public static string MRJL_GetPlatNameByPlatId( int PlatId) + public static string MRJL_GetPlatNameByPlatId(int PlatId) { //返回数据 string platName = ""; @@ -30127,7 +30132,7 @@ or guserid_tiktok = @userid"; } return platName; } - public static string MRJL_GetShopNameByShopId( int ShopId) + public static string MRJL_GetShopNameByShopId(int ShopId) { //返回数据 string platName = ""; @@ -30331,7 +30336,7 @@ LEFT JOIN JC_UserInfo c on a.UserId = c.UserId"; #region 更改采购单入库状态 - public static void UpdateCG_Purchase(string buyCode,int state) + public static void UpdateCG_Purchase(string buyCode, int state) { var sql = @" update CG_Purchase set PostState=@state where BuyCode=@buyCode @@ -30438,7 +30443,7 @@ LEFT JOIN JC_UserInfo c on c.UserID = a.GroupLeaderId } return ListModel; } - public static List GetList_DDOrderAuth(int userID, int groupLeaderId,bool isGroupLeader) + public static List GetList_DDOrderAuth(int userID, int groupLeaderId, bool isGroupLeader) { List ListModel = new List(); string tsql = @"SELECT * from DD_OrderAuth where isGroupLeader = @isGroupLeader"; @@ -30469,7 +30474,7 @@ LEFT JOIN JC_UserInfo c on c.UserID = a.GroupLeaderId #region 获取需要同步到WMS的订单 - public static List GetSyncToWMSOrderDatas(DateTime sdate,DateTime edate) + public static List GetSyncToWMSOrderDatas(DateTime sdate, DateTime edate) { var sql = @"select top 100 a.OrderId from DT_OrderInfo a with (nolock) inner join JC_Shop b with (nolock) on a.ShopId=b.ShopId @@ -30477,8 +30482,8 @@ left join [50.196.110.198].[WMS].dbo.[DT_OrderInfo] c on a.OrderCode=c.OrderCode where a.State= 1 and a.PostState!=2 and ISNULL( a.PrintState,null)=0 and ISNULL(a.IsFba,0)=0 and ISNULL(c.OrderCode,'')='' and ISNULL(a.IsSyncToWMS,1)=1 and convert(date, a.orderdate)>=@sdate and convert(date, a.OrderDate)<=@edate order by a.OrderDate "; - var db= DatabaseFactory.CreateDatabase(); - var cmd=db.GetSqlStringCommand(@sql); + var db = DatabaseFactory.CreateDatabase(); + var cmd = db.GetSqlStringCommand(@sql); db.AddInParameter(cmd, "@sdate", DbType.Date, sdate); db.AddInParameter(cmd, "@edate", DbType.Date, edate); @@ -30782,7 +30787,7 @@ update DT_OrderInfo set IsLX=@IsLX,LxMess=@LxMess,LxDate=getdate(),outboundOrde db.AddInParameter(cmd, "@outboundOrderNo", DbType.String, outboundOrderNo); db.AddInParameter(cmd, "@IsLX", DbType.Int32, IsLX); db.AddInParameter(cmd, "@LxMess", DbType.String, LxMess); - db.ExecuteScalar(cmd); + db.ExecuteScalar(cmd); return 1; } #endregion @@ -31123,7 +31128,7 @@ delete from TemuShopGoodActiveDetail where Id=@Id"; public static List GetListTemuShopGoodActiveDetail(string ids) { //string tsql = "select a.ID,a.Shopid,a.SKU,a.SPUID,a.BasePrice,a.CreateUserId,a.CreateTime,a.PostPrice,a.State from TemuShopGoodActive"; - string tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids+")"; + string tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ")"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); DataTable tb = db.ExecuteDataTable(cmd); @@ -31158,8 +31163,8 @@ left Join JC_Shop b on a.Shopid = b.Shopid"; #region 根据sku读temu订单 public static List GetTemuOrderFromSKU(string SKU) { - - string tsql = @" + + string tsql = @" select c.SKU1,KcNum=c.WestNum+c.EastNum,c.WestNum,c.EastNum,b.*,lr=b.TotalPrice-b.yj-b.ck-b.cb-b.hwsf-b.sjyf-b.sjtc from DT_OrderGoods a inner join ( select a.orderid,c.ShopName,a.PlatOrderCode,a.InDate,TotalPrice=isnull(a.TotalPrice,0),yj=isnull(b.yj,0),ck=isnull(b.ck,0),sjtc=isnull(b.sjtc,isnull(b.tc,0)),sjyf=isnull(b.sjyf,isnull(b.yf,0)),cb=isnull(b.sjcb,isnull(b.cb,0))/6.3,hwsf=isnull(b.hwsf,0)/6.3,b.sku from DT_OrderInfo a @@ -31168,12 +31173,12 @@ left join DT_Fees b on a.OrderId=b.orderid where a.State>0 and a.State<3 and a.PlatId=23)b on a.OrderId=b.OrderId inner join HW_GoodsDetail c on a.DetailId=c.DetailId where a.SKU1=@SKU"; - Database db = DatabaseFactory.CreateDatabase(); - DbCommand cmd = db.GetSqlStringCommand(tsql); + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); db.AddInParameter(cmd, "@SKU", DbType.String, SKU); DataTable tb = db.ExecuteDataTable(cmd); - return tb.ToList(); - + return tb.ToList(); + } #endregion } diff --git a/TradeManageNew/SysManageServiceNew.asmx.cs b/TradeManageNew/SysManageServiceNew.asmx.cs index b2e9afe..bb736d8 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(int PageSize, int PageIndex, string GoodsCode) + public string GetExcelTemuSKUData( string GoodsCode) { // 这里确保您的登录逻辑正确 //PagesNew.Login(this.Session); @@ -18042,7 +18042,7 @@ 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(PageSize, PageIndex, GoodsCode, out int rowCount); + slist = DataNew.GetTemuSKUData(999999, 1, GoodsCode, out int rowCount); #endregion TableColumnCollection listColumns = new TableColumnCollection(); // 添加列信息