using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Web; using DBUtility; using Tools; namespace PaintingScreen.Handler { /// /// Plan247 的摘要说明 /// public class Plan247 : 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() { Response.Write(JSONTools.DataTableToJson("result", GetTable())); Response.End(); } private static DataTable GetTable() { DataTable res = new DataTable(); try { string time = DateTime.Now.ToString("yyyyMMdd"); string sql = @"SELECT dbo.tb_Plan_247.OrderNo, dbo.tb_Plan_247.Item, dbo.tb_Plan_247.PartNo, dbo.tb_Mistake_247.PartName2, dbo.tb_Plan_247.OrderCount, dbo.tb_Plan_247.CompleteCount,CONVERT(NVARCHAR(20),ROUND(CONVERT(FLOAT,dbo.tb_Plan_247.CompleteCount) / CONVERT(FLOAT,dbo.tb_Plan_247.OrderCount),4) *100 )+'%' AS xl FROM dbo.tb_Plan_247 LEFT OUTER JOIN dbo.tb_Mistake_247 ON dbo.tb_Plan_247.PartNo = dbo.tb_Mistake_247.PartNo2 where OrderNo like '" + time + "%' order by OrderNo,Item"; res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql,null); } catch (Exception ex) { LogHelper.WriteLogManager(ex); LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name); } return res; } } }