Просмотр исходного кода

清楚json 字符串中 \n \t \r 字符

张忠帅 1 год назад
Родитель
Сommit
dab0472ebd
1 измененных файлов с 341 добавлено и 338 удалено
  1. 341 338
      wwwroot/mes/rpt/rpt007/rpt.ashx

+ 341 - 338
wwwroot/mes/rpt/rpt007/rpt.ashx

@@ -11,29 +11,29 @@ using System.Collections;
 
 public class rpt : IHttpHandler, IReadOnlySessionState
 {
-	public void ProcessRequest(HttpContext context)
-	{
-		context.Response.ContentType = "text/plain";
-		using (IDataAccess conn = DataAccess.Create())
-		{
-			string goodsParam = string.Empty;
-			string[] goodsCodes = new string[] { };
-			if (context.Request["GOODSCODE"] != "" || context.Request["GOODSCODE"] != null)
-			{
-				goodsCodes = context.Request["GOODSCODE"].ToString().Split(',');
-			}
+    public void ProcessRequest(HttpContext context)
+    {
+        context.Response.ContentType = "text/plain";
+        using (IDataAccess conn = DataAccess.Create())
+        {
+            string goodsParam = string.Empty;
+            string[] goodsCodes = new string[] { };
+            if (context.Request["GOODSCODE"] != "" || context.Request["GOODSCODE"] != null)
+            {
+                goodsCodes = context.Request["GOODSCODE"].ToString().Split(',');
+            }
 
-			#region 登窑
-			//主表
-			if (context.Request["m"].ToString() == "master")//装窑
-			{
-				DataTable goodsTable = new DataTable();
-				string sql = string.Empty;
-				//判断是否包含产品编码
-				if (context.Request["isNotcheck"].ToString() == "1")
-				{
-					//不包含
-					sql = @"SELECT DISTINCT
+            #region 登窑
+            //主表
+            if (context.Request["m"].ToString() == "master")//装窑
+            {
+                DataTable goodsTable = new DataTable();
+                string sql = string.Empty;
+                //判断是否包含产品编码
+                if (context.Request["isNotcheck"].ToString() == "1")
+                {
+                    //不包含
+                    sql = @"SELECT DISTINCT
 			                        P.GOODSCODE
 		                        FROM
 			                        TP_PM_PRODUCTIONDATA P 
@@ -41,18 +41,18 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        P.PROCEDUREID = @PROCEDUREID@
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@";
-					if (goodsCodes.Length > 1 || goodsCodes[0] != "")
-					{
-						sql += @" AND P.GOODSCODE NOT LIKE ('%" + goodsCodes[0] + "%') ";
-						for (int i = 1; i < goodsCodes.Length; i++)
-						{
-							sql += @" AND P.GOODSCODE NOT LIKE '%" + goodsCodes[i] + "%' ";
-						}
-					}
-				}
-				else
-				{//包含
-					sql = @"SELECT DISTINCT
+                    if (goodsCodes.Length > 1 || goodsCodes[0] != "")
+                    {
+                        sql += @" AND P.GOODSCODE NOT LIKE ('%" + goodsCodes[0] + "%') ";
+                        for (int i = 1; i < goodsCodes.Length; i++)
+                        {
+                            sql += @" AND P.GOODSCODE NOT LIKE '%" + goodsCodes[i] + "%' ";
+                        }
+                    }
+                }
+                else
+                {//包含
+                    sql = @"SELECT DISTINCT
 			                        P.GOODSCODE
 		                        FROM
 			                        TP_PM_PRODUCTIONDATA P 
@@ -60,39 +60,39 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        P.PROCEDUREID = @PROCEDUREID@
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@";
-					if (goodsCodes.Length > 1 || goodsCodes[0] != "")
-					{
-						sql += @" AND P.GOODSCODE  LIKE '%" + goodsCodes[0] + "%' ";
-						for (int i = 1; i < goodsCodes.Length; i++)
-						{
-							sql += @" OR P.GOODSCODE LIKE '%" + goodsCodes[i] + "%' ";
-						}
-					}
-				}
-				sql += " ORDER BY P.GOODSCODE";
-				//取产品编码
-				goodsTable = conn.ExecuteDatatable(sql,
-				new CDAParameter("PROCEDUREID", context.Request["procedureId"]),
-				new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime),
-				new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime)
-				);
+                    if (goodsCodes.Length > 1 || goodsCodes[0] != "")
+                    {
+                        sql += @" AND P.GOODSCODE  LIKE '%" + goodsCodes[0] + "%' ";
+                        for (int i = 1; i < goodsCodes.Length; i++)
+                        {
+                            sql += @" OR P.GOODSCODE LIKE '%" + goodsCodes[i] + "%' ";
+                        }
+                    }
+                }
+                sql += " ORDER BY P.GOODSCODE";
+                //取产品编码
+                goodsTable = conn.ExecuteDatatable(sql,
+                new CDAParameter("PROCEDUREID", context.Request["procedureId"]),
+                new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime),
+                new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime)
+                );
 
-				if (goodsTable.Rows.Count > 0)
-				{
-					string goodsStr = "";
-					for (int i = 0; i < goodsTable.Rows.Count; i++)
-					{
-						if (i > 0) goodsStr += ",";
-						goodsStr += "'" + goodsTable.Rows[i]["GOODSCODE"].ToString() + "'";
-					}
+                if (goodsTable.Rows.Count > 0)
+                {
+                    string goodsStr = "";
+                    for (int i = 0; i < goodsTable.Rows.Count; i++)
+                    {
+                        if (i > 0) goodsStr += ",";
+                        goodsStr += "'" + goodsTable.Rows[i]["GOODSCODE"].ToString() + "'";
+                    }
 
-					goodsParam = goodsStr;
-					//读取报表数据 带合计
-					goodsStr += ",'" + "合计" + "'";
+                    goodsParam = goodsStr;
+                    //读取报表数据 带合计
+                    goodsStr += ",'" + "合计" + "'";
 
-					//读取报表数据
-					string sqlSt = null;
-					sqlSt = @"SELECT  *  FROM
+                    //读取报表数据
+                    string sqlSt = null;
+                    sqlSt = @"SELECT  *  FROM
 	                                                (       
                                                     SELECT
 		                                                DECODE( GID, 6, '合计', 7, '合计', T.PCODE ) PCODE,
@@ -123,11 +123,11 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 				                                                AND PD.KILNID = @KILNID@
 				                                                AND KD.LOADINGTIME >= @DATEBEGIN@ 
 				                                                AND KD.LOADINGTIME <= @DATEEND@";
-					if (goodsParam != "" && goodsParam != null)
-					{
-						sqlSt += "   AND PD.GOODSCODE IN (" + goodsParam + ")";
-					}
-					sqlSt += @"   AND PD.VALUEFLAG=1
+                    if (goodsParam != "" && goodsParam != null)
+                    {
+                        sqlSt += "   AND PD.GOODSCODE IN (" + goodsParam + ")";
+                    }
+                    sqlSt += @"   AND PD.VALUEFLAG=1
                                                             ORDER BY PD.CREATETIME
 			                                                ) P
                                                         GROUP BY
@@ -139,69 +139,70 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 		                                                ) T
 		                                                     ) PIVOT (
                                                              SUM( PCOUNT ) FOR 产品编码 IN ( {GOODSCODE} )  
-	                                                ) ORDER BY  装窑时间 ASC ".Replace("{GOODSCODE}", goodsStr);
-					//获取查询条件
-					List<CDAParameter> sqlPara = new List<CDAParameter>();
-					sqlPara.Add(new CDAParameter("PROCEDUREID", context.Request["procedureId"]));
-					sqlPara.Add(new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime));
-					sqlPara.Add(new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime));
-					sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
-					//直接获取不分页数据
-					DataTable dt = conn.ExecuteDatatable(sqlSt, sqlPara.ToArray());
+	                                                ) ORDER BY  装窑时间 ASC ".Replace("{GOODSCODE}", goodsStr.Replace(" ","").Replace("\n",""));
+                    //获取查询条件
+                    List<CDAParameter> sqlPara = new List<CDAParameter>();
+                    sqlPara.Add(new CDAParameter("PROCEDUREID", context.Request["procedureId"]));
+                    sqlPara.Add(new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime));
+                    sqlPara.Add(new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime));
+                    sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
+                    //直接获取不分页数据
+                    DataTable dt = conn.ExecuteDatatable(sqlSt, sqlPara.ToArray());
 
-					dt.Columns.Add("窑车编号").SetOrdinal(0);
-					dt.Columns.Add("生产工号").SetOrdinal(1);
+                    dt.Columns.Add("窑车编号").SetOrdinal(0);
+                    dt.Columns.Add("生产工号").SetOrdinal(1);
 
-					for (int i = 1; i < dt.Columns.Count; i++)
-					{
-						dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.ToString().ToUpper().Replace("-", "|").Replace("*", " ").Replace("'", null);
-					}
+                    for (int i = 1; i < dt.Columns.Count; i++)
+                    {
+                        dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.ToString().ToUpper().Replace("-", "|").Replace("*", " ").Replace("'", null);
+                    }
 
-					for (int i = 0; i < dt.Rows.Count; i++)
-					{
-						//去掉窑炉号
-						dt.Rows[i]["PCODE"] = (dt.Rows[i]["PCODE"] + "").ToUpper()
-							.Replace("SK1", "")
-							.Replace("SK2", "")
-							.Replace("TK1", "")
-							.Replace("TK2", "");
+                    for (int i = 0; i < dt.Rows.Count; i++)
+                    {
+                        //去掉窑炉号
+                        dt.Rows[i]["PCODE"] = (dt.Rows[i]["PCODE"] + "").ToUpper()
+                            .Replace("SK1", "")
+                            .Replace("SK2", "")
+                            .Replace("TK1", "")
+                            .Replace("TK2", "");
 
-						if (dt.Rows[i]["PCODE"].ToString().IndexOf("_") > 0)
-						{
-							dt.Rows[i]["窑车编号"] = dt.Rows[i]["PCODE"].ToString().Substring(0, dt.Rows[i]["PCODE"].ToString().IndexOf("_"));
-							dt.Rows[i]["生产工号"] = dt.Rows[i]["PCODE"].ToString().Substring(dt.Rows[i]["PCODE"].ToString().IndexOf("_") + 1);
-						}
-						else
-						{
-							dt.Rows[i]["窑车编号"] = "合计";
-							dt.Rows[i]["生产工号"] = "";
-						}
-					}
-					DataView dv = dt.DefaultView;
-					dt.Columns.Remove(dt.Columns["PCODE"]);
-					dt = dv.ToTable();
-					string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
-					context.Response.Write(jsonStr);
-				}
-				else
-				{
-					//没有数据
-					string jsonStr = new JsonResult(new DataTable()) { total = 0 }.ToJson();
-					context.Response.Write(jsonStr);
-				}
-			}
-			#endregion
+                        if (dt.Rows[i]["PCODE"].ToString().IndexOf("_") > 0)
+                        {
+                            dt.Rows[i]["窑车编号"] = dt.Rows[i]["PCODE"].ToString().Substring(0, dt.Rows[i]["PCODE"].ToString().IndexOf("_"));
+                            dt.Rows[i]["生产工号"] = dt.Rows[i]["PCODE"].ToString().Substring(dt.Rows[i]["PCODE"].ToString().IndexOf("_") + 1);
+                        }
+                        else
+                        {
+                            dt.Rows[i]["窑车编号"] = "合计";
+                            dt.Rows[i]["生产工号"] = "";
+                        }
+                    }
+                    DataView dv = dt.DefaultView;
+                    dt.Columns.Remove(dt.Columns["PCODE"]);
+                    dt = dv.ToTable();
+                   string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
+                    string jsonStrs = jsonStr.Replace("\r" ,"").Replace("\n" ,"").Replace("\t" ,"");
+                    context.Response.Write(jsonStr);
+                }
+                else
+                {
+                    //没有数据
+                    string jsonStr = new JsonResult(new DataTable()) { total = 0 }.ToJson();
+                    context.Response.Write(jsonStr);
+                }
+            }
+            #endregion
 
-			#region 入窑
-			//子表
-			if (context.Request["m"].ToString() == "detail")//入窑
-			{
+            #region 入窑
+            //子表
+            if (context.Request["m"].ToString() == "detail")//入窑
+            {
 
-				string sql = string.Empty;
-				if (context.Request["isNotcheck"].ToString() == "1")
-				{
-					//不包含
-					sql = @"SELECT DISTINCT
+                string sql = string.Empty;
+                if (context.Request["isNotcheck"].ToString() == "1")
+                {
+                    //不包含
+                    sql = @"SELECT DISTINCT
 			                        P.GOODSCODE
 		                        FROM
 			                        TP_PM_PRODUCTIONDATA P 
@@ -209,18 +210,18 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        P.PROCEDUREID = @PROCEDUREID@
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@";
-					if (goodsCodes.Length > 1 || goodsCodes[0] != "")
-					{
-						sql += @" AND P.GOODSCODE NOT LIKE ('%" + goodsCodes[0] + "%') ";
-						for (int i = 1; i < goodsCodes.Length; i++)
-						{
-							sql += @" AND P.GOODSCODE NOT LIKE '%" + goodsCodes[i] + "%' ";
-						}
-					}
-				}
-				else
-				{//包含yf 中试
-					sql = @"SELECT DISTINCT
+                    if (goodsCodes.Length > 1 || goodsCodes[0] != "")
+                    {
+                        sql += @" AND P.GOODSCODE NOT LIKE ('%" + goodsCodes[0] + "%') ";
+                        for (int i = 1; i < goodsCodes.Length; i++)
+                        {
+                            sql += @" AND P.GOODSCODE NOT LIKE '%" + goodsCodes[i] + "%' ";
+                        }
+                    }
+                }
+                else
+                {//包含yf 中试
+                    sql = @"SELECT DISTINCT
 			                        P.GOODSCODE
 		                        FROM
 			                        TP_PM_PRODUCTIONDATA P 
@@ -228,37 +229,37 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        P.PROCEDUREID = @PROCEDUREID@
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@";
-					if (goodsCodes.Length > 1 || goodsCodes[0] != "")
-					{
-						sql += @" AND P.GOODSCODE  LIKE '%" + goodsCodes[0] + "%' ";
-						for (int i = 1; i < goodsCodes.Length; i++)
-						{
-							sql += @" OR P.GOODSCODE LIKE '%" + goodsCodes[i] + "%' ";
-						}
-					}
-				}
+                    if (goodsCodes.Length > 1 || goodsCodes[0] != "")
+                    {
+                        sql += @" AND P.GOODSCODE  LIKE '%" + goodsCodes[0] + "%' ";
+                        for (int i = 1; i < goodsCodes.Length; i++)
+                        {
+                            sql += @" OR P.GOODSCODE LIKE '%" + goodsCodes[i] + "%' ";
+                        }
+                    }
+                }
 
-				sql += " ORDER BY P.GOODSCODE";
-				//取产品编码
-				DataTable goodsTable = conn.ExecuteDatatable(sql,
-				new CDAParameter("PROCEDUREID", context.Request["procedureId"]),
-				new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime),
-				new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime)
-				);
+                sql += " ORDER BY P.GOODSCODE";
+                //取产品编码
+                DataTable goodsTable = conn.ExecuteDatatable(sql,
+                new CDAParameter("PROCEDUREID", context.Request["procedureId"]),
+                new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime),
+                new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime)
+                );
 
-				if (goodsTable.Rows.Count > 0)
-				{
-					string goodsStr = "";
-					for (int i = 0; i < goodsTable.Rows.Count; i++)
-					{
-						if (i > 0) goodsStr += ",";
-						goodsStr += "'" + goodsTable.Rows[i]["GOODSCODE"].ToString() + "'";
-					}
-					goodsParam = goodsStr;
-					goodsStr += ",'" + "合计" + "'";
-					string sqlSt = null;
-					//读取报表数据
-					sqlSt = @"SELECT
+                if (goodsTable.Rows.Count > 0)
+                {
+                    string goodsStr = "";
+                    for (int i = 0; i < goodsTable.Rows.Count; i++)
+                    {
+                        if (i > 0) goodsStr += ",";
+                        goodsStr += "'" + goodsTable.Rows[i]["GOODSCODE"].ToString() + "'";
+                    }
+                    goodsParam = goodsStr;
+                    goodsStr += ",'" + "合计" + "'";
+                    string sqlSt = null;
+                    //读取报表数据
+                    sqlSt = @"SELECT
 	                                          * 
                                               FROM
 	                                                (
@@ -291,11 +292,11 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 				                                                AND PD.KILNID = @KILNID@
 				                                                AND KD.INTOKILNTIME >= @DATEBEGIN@ 
 				                                                AND KD.INTOKILNTIME <= @DATEEND@";
-					if (goodsParam != "" && goodsParam != null)
-					{
-						sqlSt += "   AND PD.GOODSCODE IN (" + goodsParam + ")";
-					}
-					sqlSt += @"  AND PD.VALUEFLAG=1
+                    if (goodsParam != "" && goodsParam != null)
+                    {
+                        sqlSt += "   AND PD.GOODSCODE IN (" + goodsParam + ")";
+                    }
+                    sqlSt += @"  AND PD.VALUEFLAG=1
                                                             ORDER BY PD.CREATETIME
 			                                                ) P
                                                         GROUP BY
@@ -306,63 +307,64 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                                                                 ( ) )
 		                                                ) T
 	                                    ) PIVOT (
-                                    SUM( PCOUNT ) FOR 产品编码 IN ( {GOODSCODE} ) )ORDER BY  入窑时间 ASC ".Replace("{GOODSCODE}", goodsStr);
-					//获取查询条件
-					List<CDAParameter> sqlPara = new List<CDAParameter>();
-					sqlPara.Add(new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime));
-					sqlPara.Add(new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime));
-					sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
-					//直接获取不分页数据
-					DataTable dt = conn.ExecuteDatatable(sqlSt, sqlPara.ToArray());
-					dt.Columns.Add("窑车编号").SetOrdinal(0);
-					dt.Columns.Add("生产工号").SetOrdinal(1);
-					for (int i = 1; i < dt.Columns.Count; i++)
-					{
-						dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.ToString().ToUpper().Replace("-", "|").Replace("*", " ").Replace("'", null);
-					}
-					for (int i = 0; i < dt.Rows.Count; i++)
-					{
-						//去掉窑炉号
-						dt.Rows[i]["PCODE"] = (dt.Rows[i]["PCODE"] + "").ToUpper()
-							.Replace("SK1", "")
-							.Replace("SK2", "")
-							.Replace("TK1", "")
-							.Replace("TK2", "");
-						if (dt.Rows[i]["PCODE"].ToString().IndexOf("_") > 0)
-						{
-							dt.Rows[i]["窑车编号"] = dt.Rows[i]["PCODE"].ToString().Substring(0, dt.Rows[i]["PCODE"].ToString().IndexOf("_"));
-							dt.Rows[i]["生产工号"] = dt.Rows[i]["PCODE"].ToString().Substring(dt.Rows[i]["PCODE"].ToString().IndexOf("_") + 1);
-						}
-						else
-						{
-							dt.Rows[i]["窑车编号"] = "合计";
-							dt.Rows[i]["生产工号"] = "";
-						}
-					}
-					DataView dv = dt.DefaultView;
-					dt.Columns.Remove(dt.Columns["PCODE"]);
+                                    SUM( PCOUNT ) FOR 产品编码 IN ( {GOODSCODE} ) )ORDER BY  入窑时间 ASC ".Replace("{GOODSCODE}", goodsStr.Replace(" ","").Replace("\n",""));
+                    //获取查询条件
+                    List<CDAParameter> sqlPara = new List<CDAParameter>();
+                    sqlPara.Add(new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime));
+                    sqlPara.Add(new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime));
+                    sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
+                    //直接获取不分页数据
+                    DataTable dt = conn.ExecuteDatatable(sqlSt, sqlPara.ToArray());
+                    dt.Columns.Add("窑车编号").SetOrdinal(0);
+                    dt.Columns.Add("生产工号").SetOrdinal(1);
+                    for (int i = 1; i < dt.Columns.Count; i++)
+                    {
+                        dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.ToString().ToUpper().Replace("-", "|").Replace("*", " ").Replace("'", null);
+                    }
+                    for (int i = 0; i < dt.Rows.Count; i++)
+                    {
+                        //去掉窑炉号
+                        dt.Rows[i]["PCODE"] = (dt.Rows[i]["PCODE"] + "").ToUpper()
+                            .Replace("SK1", "")
+                            .Replace("SK2", "")
+                            .Replace("TK1", "")
+                            .Replace("TK2", "");
+                        if (dt.Rows[i]["PCODE"].ToString().IndexOf("_") > 0)
+                        {
+                            dt.Rows[i]["窑车编号"] = dt.Rows[i]["PCODE"].ToString().Substring(0, dt.Rows[i]["PCODE"].ToString().IndexOf("_"));
+                            dt.Rows[i]["生产工号"] = dt.Rows[i]["PCODE"].ToString().Substring(dt.Rows[i]["PCODE"].ToString().IndexOf("_") + 1);
+                        }
+                        else
+                        {
+                            dt.Rows[i]["窑车编号"] = "合计";
+                            dt.Rows[i]["生产工号"] = "";
+                        }
+                    }
+                    DataView dv = dt.DefaultView;
+                    dt.Columns.Remove(dt.Columns["PCODE"]);
 
-					dt = dv.ToTable();
-					string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
-					context.Response.Write(jsonStr);
-				}
-				else
-				{
-					//没有数据
-					string jsonStr = new JsonResult(new DataTable()) { total = 0 }.ToJson();
-					context.Response.Write(jsonStr);
-				}
-			}
-			#endregion
+                    dt = dv.ToTable();
+                    string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
+                    string jsonStrs = jsonStr.Replace("\r" ,"").Replace("\n" ,"").Replace("\t" ,"");
+                    context.Response.Write(jsonStrs);
+                }
+                else
+                {
+                    //没有数据
+                    string jsonStr = new JsonResult(new DataTable()) { total = 0 }.ToJson();
+                    context.Response.Write(jsonStr);
+                }
+            }
+            #endregion
 
-			#region 总计
-			if (context.Request["m"].ToString() == "DataAll")//总计
-			{
-				string sql = string.Empty;
-				if (context.Request["isNotcheck"].ToString() == "1")
-				{
-					//不包含
-					sql = @"SELECT DISTINCT
+            #region 总计
+            if (context.Request["m"].ToString() == "DataAll")//总计
+            {
+                string sql = string.Empty;
+                if (context.Request["isNotcheck"].ToString() == "1")
+                {
+                    //不包含
+                    sql = @"SELECT DISTINCT
 			                        P.GOODSCODE
 		                        FROM
 			                        TP_PM_PRODUCTIONDATA P 
@@ -370,18 +372,18 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        P.PROCEDUREID = @PROCEDUREID@
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@";
-					if (goodsCodes.Length > 1 || goodsCodes[0] != "")
-					{
-						sql += @" AND P.GOODSCODE NOT LIKE ('%" + goodsCodes[0] + "%') ";
-						for (int i = 1; i < goodsCodes.Length; i++)
-						{
-							sql += @" AND P.GOODSCODE NOT LIKE '%" + goodsCodes[i] + "%' ";
-						}
-					}
-				}
-				else
-				{//包含yf 中试
-					sql = @"SELECT DISTINCT
+                    if (goodsCodes.Length > 1 || goodsCodes[0] != "")
+                    {
+                        sql += @" AND P.GOODSCODE NOT LIKE ('%" + goodsCodes[0] + "%') ";
+                        for (int i = 1; i < goodsCodes.Length; i++)
+                        {
+                            sql += @" AND P.GOODSCODE NOT LIKE '%" + goodsCodes[i] + "%' ";
+                        }
+                    }
+                }
+                else
+                {//包含yf 中试
+                    sql = @"SELECT DISTINCT
 			                        P.GOODSCODE
 		                        FROM
 			                        TP_PM_PRODUCTIONDATA P 
@@ -389,36 +391,36 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        P.PROCEDUREID = @PROCEDUREID@
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@";
-					if (goodsCodes.Length > 1 || goodsCodes[0] != "")
-					{
-						sql += @" AND P.GOODSCODE  LIKE '%" + goodsCodes[0] + "%' ";
-						for (int i = 1; i < goodsCodes.Length; i++)
-						{
-							sql += @" OR P.GOODSCODE LIKE '%" + goodsCodes[i] + "%' ";
-						}
-					}
-				}
-				sql += " ORDER BY P.GOODSCODE";
-				//取产品编码
-				DataTable goodsTable = conn.ExecuteDatatable(sql,
-				new CDAParameter("PROCEDUREID", context.Request["procedureId"]),
-				new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime),
-				new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime)
-				);
-				if (goodsTable.Rows.Count > 0)
-				{
-					string goodsStr = "";
-					for (int i = 0; i < goodsTable.Rows.Count; i++)
-					{
-						if (i > 0) goodsStr += ",";
-						goodsStr += "'" + goodsTable.Rows[i]["GOODSCODE"].ToString() + "'";
-					}
-					goodsParam = goodsStr;
-					goodsStr += ",'" + "合计" + "'";
-					//读取报表数据 带合计
-					string sqlSt = null;
-					//读取报表数据
-					sqlSt = @"SELECT  *  FROM
+                    if (goodsCodes.Length > 1 || goodsCodes[0] != "")
+                    {
+                        sql += @" AND P.GOODSCODE  LIKE '%" + goodsCodes[0] + "%' ";
+                        for (int i = 1; i < goodsCodes.Length; i++)
+                        {
+                            sql += @" OR P.GOODSCODE LIKE '%" + goodsCodes[i] + "%' ";
+                        }
+                    }
+                }
+                sql += " ORDER BY P.GOODSCODE";
+                //取产品编码
+                DataTable goodsTable = conn.ExecuteDatatable(sql,
+                new CDAParameter("PROCEDUREID", context.Request["procedureId"]),
+                new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime),
+                new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime)
+                );
+                if (goodsTable.Rows.Count > 0)
+                {
+                    string goodsStr = "";
+                    for (int i = 0; i < goodsTable.Rows.Count; i++)
+                    {
+                        if (i > 0) goodsStr += ",";
+                        goodsStr += "'" + goodsTable.Rows[i]["GOODSCODE"].ToString() + "'";
+                    }
+                    goodsParam = goodsStr;
+                    goodsStr += ",'" + "合计" + "'";
+                    //读取报表数据 带合计
+                    string sqlSt = null;
+                    //读取报表数据
+                    sqlSt = @"SELECT  *  FROM
 	                        (
 	                        SELECT
 		                        DECODE( GID, 6, '合计', 7, '合计', T.PCODE ) PCODE,
@@ -438,11 +440,11 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			                        AND KILNID = @KILNID@ 
 			                        AND P.CREATETIME >= @DATEBEGIN@  
 			                        AND P.CREATETIME <= @DATEEND@  ";
-					if (goodsParam != "" && goodsParam != null)
-					{
-						sqlSt += "   AND P.GOODSCODE IN (" + goodsParam + ")";
-					}
-					sqlSt += @"  AND P.VALUEFLAG=1
+                    if (goodsParam != "" && goodsParam != null)
+                    {
+                        sqlSt += "   AND P.GOODSCODE IN (" + goodsParam + ")";
+                    }
+                    sqlSt += @"  AND P.VALUEFLAG=1
 
                                 GROUP BY
 
@@ -458,71 +460,72 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                         ORDER BY
 
                             PCODE
-                    ".Replace("{GOODSCODE}", goodsStr);
-					//获取查询条件
-					List<CDAParameter> sqlPara = new List<CDAParameter>();
-					//sqlPara.Add(new CDAParameter("ACCOUNTID", context.Session["accountId"].ToString()));
-					sqlPara.Add(new CDAParameter("PROCEDUREID", context.Request["procedureId"]));
-					sqlPara.Add(new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime));
-					sqlPara.Add(new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime));
-					sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
-					sqlPara.Add(new CDAParameter("GOODSCODE", context.Request["goodscodeMaster"]));
-					//直接获取不分页数据
-					DataTable dt = conn.ExecuteDatatable(sqlSt, sqlPara.ToArray());
-					dt.Columns.Add("窑车编号").SetOrdinal(0);
-					dt.Columns.Add("生产工号").SetOrdinal(1);
-					for (int i = 1; i < dt.Columns.Count; i++)
-					{
-						dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.ToString().ToUpper().Replace("-", "|").Replace("*", " ").Replace("'", null);
-					}
-					for (int i = 0; i < dt.Rows.Count; i++)
-					{
-						//去掉窑炉号
-						dt.Rows[i]["PCODE"] = (dt.Rows[i]["PCODE"] + "").ToUpper()
-							.Replace("SK1", "")
-							.Replace("SK2", "")
-							.Replace("TK1", "")
-							.Replace("TK2", "");
-						if (dt.Rows[i]["PCODE"].ToString().IndexOf("_") > 0)
-						{
-							dt.Rows[i]["窑车编号"] = dt.Rows[i]["PCODE"].ToString().Substring(0, dt.Rows[i]["PCODE"].ToString().IndexOf("_"));
-							dt.Rows[i]["生产工号"] = dt.Rows[i]["PCODE"].ToString().Substring(dt.Rows[i]["PCODE"].ToString().IndexOf("_") + 1);
-						}
-						else
-						{
-							dt.Rows[i]["窑车编号"] = "合计";
-							dt.Rows[i]["生产工号"] = "";
-						}
-					}
-					DataView dv = dt.DefaultView;
-					dt.Columns.Remove(dt.Columns["PCODE"]);
-					dt = dv.ToTable();
-					string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
-					context.Response.Write(jsonStr);
-				}
-				else
-				{
-					//没有数据
-					string jsonStr = new JsonResult(new DataTable()) { total = 0 }.ToJson();
-					context.Response.Write(jsonStr);
-				}
-				#endregion
+                    ".Replace("{GOODSCODE}", goodsStr.Replace(" ","").Replace("\n",""));
+                    //获取查询条件
+                    List<CDAParameter> sqlPara = new List<CDAParameter>();
+                    //sqlPara.Add(new CDAParameter("ACCOUNTID", context.Session["accountId"].ToString()));
+                    sqlPara.Add(new CDAParameter("PROCEDUREID", context.Request["procedureId"]));
+                    sqlPara.Add(new CDAParameter("DATEBEGIN", Convert.ToDateTime(context.Request["datebeginMaster"]), DataType.DateTime));
+                    sqlPara.Add(new CDAParameter("DATEEND", Convert.ToDateTime(context.Request["dateendMaster"]), DataType.DateTime));
+                    sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
+                    sqlPara.Add(new CDAParameter("GOODSCODE", context.Request["goodscodeMaster"]));
+                    //直接获取不分页数据
+                    DataTable dt = conn.ExecuteDatatable(sqlSt, sqlPara.ToArray());
+                    dt.Columns.Add("窑车编号").SetOrdinal(0);
+                    dt.Columns.Add("生产工号").SetOrdinal(1);
+                    for (int i = 1; i < dt.Columns.Count; i++)
+                    {
+                        dt.Columns[i].ColumnName = dt.Columns[i].ColumnName.ToString().ToUpper().Replace("-", "|").Replace("*", " ").Replace("'", null);
+                    }
+                    for (int i = 0; i < dt.Rows.Count; i++)
+                    {
+                        //去掉窑炉号
+                        dt.Rows[i]["PCODE"] = (dt.Rows[i]["PCODE"] + "").ToUpper()
+                            .Replace("SK1", "")
+                            .Replace("SK2", "")
+                            .Replace("TK1", "")
+                            .Replace("TK2", "");
+                        if (dt.Rows[i]["PCODE"].ToString().IndexOf("_") > 0)
+                        {
+                            dt.Rows[i]["窑车编号"] = dt.Rows[i]["PCODE"].ToString().Substring(0, dt.Rows[i]["PCODE"].ToString().IndexOf("_"));
+                            dt.Rows[i]["生产工号"] = dt.Rows[i]["PCODE"].ToString().Substring(dt.Rows[i]["PCODE"].ToString().IndexOf("_") + 1);
+                        }
+                        else
+                        {
+                            dt.Rows[i]["窑车编号"] = "合计";
+                            dt.Rows[i]["生产工号"] = "";
+                        }
+                    }
+                    DataView dv = dt.DefaultView;
+                    dt.Columns.Remove(dt.Columns["PCODE"]);
+                    dt = dv.ToTable();
+                    string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
+                    string jsonStrs = jsonStr.Replace("\r" ,"").Replace("\n" ,"").Replace("\t" ,"");
+                    context.Response.Write(jsonStr);
+                }
+                else
+                {
+                    //没有数据
+                    string jsonStr = new JsonResult(new DataTable()) { total = 0 }.ToJson();
+                    context.Response.Write(jsonStr);
+                }
+                #endregion
 
-			}
-		}
-	}
-	public class kiln
-	{
-		public string kilncode { get; set; }
-		public string usercode { get; set; }
-	}
+            }
+        }
+    }
+    public class kiln
+    {
+        public string kilncode { get; set; }
+        public string usercode { get; set; }
+    }
 
-	public bool IsReusable
-	{
-		get
-		{
-			return false;
-		}
-	}
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
 
 }