Browse Source

添加合计

李士越 10 months ago
parent
commit
62dee39bb7
1 changed files with 59 additions and 28 deletions
  1. 59 28
      wwwroot/mes/rpt/rpt041/rpt.ashx

+ 59 - 28
wwwroot/mes/rpt/rpt041/rpt.ashx

@@ -7,6 +7,9 @@ using System.Data;
 using System.Collections.Generic;
 using Curtain.DataAccess;
 using DK.XuWei.WebMes;
+using System.Linq;
+using System.Linq.Expressions;
+
 
 public class rpt : IHttpHandler, IReadOnlySessionState
 {
@@ -42,39 +45,67 @@ FROM
 	LEFT JOIN tp_mst_datadictionary d ON g.glazetypeid = d.dictionaryid  
 WHERE
 	sec.valueflag = 1 ";
-                if (context.Request["firstdatebeginMaster"].ToString()!="")
-                {
-                    sqlStr += " and pfirst.CREATETIME>=@firstdatebeginMaster@" ;
-                }
-				if (context.Request["firstdateendMaster"].ToString()!="")
-                {
-                   sqlStr += " and pfirst.CREATETIME<=@firstdateendMaster@" ;
-                }
-				if (context.Request["twodatebeginMaster"].ToString()!="")
-                {
-                   sqlStr += " and sec.CREATETIME>=@twodatebeginMaster@" ;
-                }
-				if (context.Request["twodateendMaster"].ToString()!="")
-                {
-                    sqlStr += " and sec.CREATETIME<=@twodateendMaster@" ;
-                }
-                //获取查询条件
-                List<CDAParameter> sqlPara = new List<CDAParameter>();
-                sqlPara.Add(new CDAParameter("firstdatebeginMaster", Convert.ToDateTime(context.Request["firstdatebeginMaster"]), DataType.DateTime));
-                sqlPara.Add(new CDAParameter("firstdateendMaster", Convert.ToDateTime(context.Request["firstdateendMaster"]).AddSeconds(1), DataType.DateTime));
-				sqlPara.Add(new CDAParameter("twodatebeginMaster", Convert.ToDateTime(context.Request["twodatebeginMaster"]), DataType.DateTime));
-                sqlPara.Add(new CDAParameter("twodateendMaster", Convert.ToDateTime(context.Request["twodateendMaster"]).AddSeconds(1), DataType.DateTime));
+            if (context.Request["firstdatebeginMaster"].ToString() != "")
+            {
+                sqlStr += " and pfirst.CREATETIME>=@firstdatebeginMaster@";
+            }
+            if (context.Request["firstdateendMaster"].ToString() != "")
+            {
+                sqlStr += " and pfirst.CREATETIME<=@firstdateendMaster@";
+            }
+            if (context.Request["twodatebeginMaster"].ToString() != "")
+            {
+                sqlStr += " and sec.CREATETIME>=@twodatebeginMaster@";
+            }
+            if (context.Request["twodateendMaster"].ToString() != "")
+            {
+                sqlStr += " and sec.CREATETIME<=@twodateendMaster@";
+            }
+            ////预备出以后的查询条件 
+            //if (context.Request["GOODSCODE"].ToString() != "")
+            //{
+            //    sqlStr += " and goods.GOODSCODE=@GOODSCODE@";
+
+            //}
+            //if (context.Request["BARCODE"].ToString() != "")
+            //{
+            //    sqlStr += " and pd.BARCODE =@BARCODE@";
+
+            //}
+            ////首检工号
+            //if (context.Request["usercode"].ToString() != "")
+            //{
+            //    sqlStr += " and pfirst.usercode =@usercode@";
+            //}
+            ////复检工号
+            //if (context.Request["usercode2"].ToString() != "")
+            //{
+            //    sqlStr += " and pd.usercode =@usercode2@";
+            //}
+            //获取查询条件
+            List<CDAParameter> sqlPara = new List<CDAParameter>();
+            sqlPara.Add(new CDAParameter("firstdatebeginMaster", Convert.ToDateTime(context.Request["firstdatebeginMaster"]), DataType.DateTime));
+            sqlPara.Add(new CDAParameter("firstdateendMaster", Convert.ToDateTime(context.Request["firstdateendMaster"]).AddSeconds(1), DataType.DateTime));
+            sqlPara.Add(new CDAParameter("twodatebeginMaster", Convert.ToDateTime(context.Request["twodatebeginMaster"]), DataType.DateTime));
+            sqlPara.Add(new CDAParameter("twodateendMaster", Convert.ToDateTime(context.Request["twodateendMaster"]).AddSeconds(1), DataType.DateTime));
 
 
-             
-           //获取分页数据    
-                int total = 0;
-                DataTable dt = conn.ExecuteDatatable(sqlStr, sqlPara.ToArray());
-                string jsonStr = new JsonResult(dt) { total = total }.ToJson();
+
+            //获取分页数据    
+            int total = 0;
+            DataTable dt = conn.ExecuteDatatable(sqlStr, sqlPara.ToArray());
+            if (dt.Rows.Count > 0)
+            {
+                DataRow dr = dt.NewRow();
+                dr[6] = "合计";
+                dr[7] = dt.Rows.Count;
+                dr[8] = dt.Rows.Count;
+                dt.Rows.Add(dr);
+            }
+            string jsonStr = new JsonResult(dt) { total = total }.ToJson();
             context.Response.Write(jsonStr);
         }
     }
-
     public bool IsReusable
     {
         get