You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.7 KiB
86 lines
2.7 KiB
3 months ago
|
using DBUtility;
|
||
|
using System;
|
||
|
using System.Data;
|
||
|
using System.Reflection;
|
||
|
using System.Web;
|
||
|
using Tools;
|
||
|
|
||
|
namespace PaintingScreen.Handler
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Handler1 的摘要说明
|
||
|
/// </summary>
|
||
|
public class Handler1 : IHttpHandler
|
||
|
{
|
||
|
HttpRequest Request = null;
|
||
|
HttpResponse Response = null;
|
||
|
|
||
|
public void ProcessRequest(HttpContext context)
|
||
|
{
|
||
|
context.Response.ContentType = "text/plain";
|
||
|
Request = context.Request;
|
||
|
Response = context.Response;
|
||
|
string method = Request.Params["method"];
|
||
|
switch (method)
|
||
|
{
|
||
|
case "GetTableContent":
|
||
|
GetTableContent();
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public bool IsReusable
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void GetTableContent()
|
||
|
{
|
||
|
string starttime = Request.Params["StartTime"];
|
||
|
string endtime = Request.Params["EndTime"];
|
||
|
Response.Write(JSONTools.DataTableToJson("result", GetTable(starttime, endtime)));
|
||
|
Response.End();
|
||
|
}
|
||
|
|
||
|
private static DataTable GetTable(string starttime, string endtime)
|
||
|
{
|
||
|
DataTable res = new DataTable();
|
||
|
try
|
||
|
{
|
||
|
|
||
|
string sql = @"
|
||
|
declare @starttime datetime;
|
||
|
declare @endtime datetime;
|
||
|
set @starttime = '" + starttime + @"';
|
||
|
set @endtime = '" + endtime + @"';
|
||
|
select substring(barcode,1, 10) stockNo
|
||
|
,[ColorName]
|
||
|
into #a
|
||
|
from tb_PaintLoad
|
||
|
where CreateTime >= @starttime and CreateTime <= @endtime
|
||
|
|
||
|
|
||
|
|
||
|
select b.productName col1, a.ColorName col2, count(0) col3
|
||
|
from #a a
|
||
|
join tb_Product b
|
||
|
on a.stockNo = b.stockNo
|
||
|
group by b.productName, a.ColorName;
|
||
|
|
||
|
drop table #a;
|
||
|
";
|
||
|
|
||
|
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogHelper.WriteLogManager(ex);
|
||
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
||
|
}
|
||
|
return res;
|
||
|
}
|
||
|
}
|
||
|
}
|