void SelectCauseOfFailure()    //查询故障原因
        {
            DataTable ResTable = Failure_BLL.GetTable();
            string    json     = FunCommon.DataTableToJson(ResTable);

            Response.Write(json);
            Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request   = System.Web.HttpContext.Current.Request;
            string      StartTime = request["StartTime"];
            string      EndTime   = request["EndTime"];
            int         Flag      = Convert.ToInt32(request["Flag"]); //按天,flag=2,按小时,flag=1
            string      st_no     = request["st_no"];
            string      method    = request["method"];
            string      JsonStr   = "[]";
            DataTable   outtable;

            if (string.IsNullOrWhiteSpace(method))
            {
                volumn_report_BLL.GetAddupProducts(method, StartTime, EndTime, Flag, st_no, out outtable);
                //ExcelHelper.ExportDTtoExcel(outtable, "产量报表", HttpContext.Current.Request.MapPath("~/App_Data/产量报表.xlsx"));
                if (outtable != null)
                {
                    JsonStr = FunCommon.DataTableToJson(outtable);
                }
                context.Response.ContentType = "text/plain";
                context.Response.Write(JsonStr);
                context.Response.End();
            }
            else
            {
                //DataReader.GetAddupProducts(method, StartTime, EndTime, Flag, st_no, out outtable);
                volumn_report_BLL.GetAddupProducts(method, StartTime, EndTime, Flag, st_no, out outtable);

                if (outtable != null)
                {
                    try
                    {
                        string fileName = HttpContext.Current.Request.MapPath("~/App_Data/产量报表.xlsx");

                        // ExcelHelper.ExportDTtoExcel(outtable, "产量报表", HttpContext.Current.Request.MapPath("~/App_Data/产量报表.xlsx"));
                        string err = "";
                        AsposeExcelTools.DataTableToExcel2(outtable, fileName, out err);
                        string ss = "true";
                        if (err.Length < 1)
                        {
                            ss = "true";
                        }
                        else
                        {
                            ss = "false";
                        }
                        JsonStr = ss;
                    }
                    catch
                    {
                        JsonStr = "false";
                    }
                }
                context.Response.ContentType = "json";
                context.Response.Write(JsonStr);
                context.Response.End();
            }
        }
        public void ProcessRequest(HttpContext context)
        {//excel
            HttpRequest request   = System.Web.HttpContext.Current.Request;
            string      StartTime = request["StartTime"];
            string      EndTime   = request["EndTime"];
            int         Flag      = Convert.ToInt32(request["Flag"]);
            string      st_no     = request["st_no"];
            string      method    = request["method"];

            if (string.IsNullOrWhiteSpace(method))
            {
                DataTable resTable = Time_ReportBLL.TimeProducts(StartTime, EndTime, Flag, st_no);
                string    JsonStr  = "[]";
                if (resTable != null)
                {
                    JsonStr = FunCommon.DataTableToJson(resTable);
                }

                context.Response.ContentType = "text/plain";
                context.Response.Write(JsonStr);
                context.Response.End();
            }
            else
            {
                string json = "";
                try
                {
                    DataTable resTable = Time_ReportBLL.TimeProducts(StartTime, EndTime, Flag, st_no);
                    //ExcelHelper.ExportDTtoExcel(resTable, "", HttpContext.Current.Request.MapPath("~/App_Data/时间信息报表.xlsx"));
                    string fileName = HttpContext.Current.Request.MapPath("~/App_Data/时间信息报表.xlsx");
                    string err      = "";
                    AsposeExcelTools.DataTableToExcel2(resTable, fileName, out err);
                    string ss = "true";
                    if (err.Length < 1)
                    {
                        ss = "true";
                    }
                    else
                    {
                        ss = "false";
                    }

                    json = ss;
                }
                catch
                {
                    json = "false";
                }
                context.Response.ContentType = "json";
                context.Response.Write(json);
            }
        }
Пример #4
0
        void order()   //检测返修页面查询全部订单号
        {
            JavaScriptSerializer s       = new JavaScriptSerializer();
            HttpRequest          request = HttpContext.Current.Request;
            string StartTime             = request.Params["StartTime"];
            string EndTime = request.Params["EndTime"];
            string sql     = "select distinct  REPLACE(a.OrderNo, CHAR(13) + CHAR(10), '') as OrderNo from mg_Test_Part_Record a";

            if (!String.IsNullOrEmpty(StartTime))
            {
                sql += "  where a.CreateTime >'" + StartTime + "'";
            }
            if (!String.IsNullOrEmpty(EndTime))
            {
                sql += "  and a.CreateTime < '" + EndTime + "' ";
            }
            sql += "  order by OrderNo";

            DataTable ResTable1 = SqlHelper.GetDataDataTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
            string    json      = FunCommon.DataTableToJson(ResTable1);

            Response.Write(json);
            Response.End();
        }