浏览代码

新每窑

姜永辉 10 月之前
父节点
当前提交
58aea4ab22

+ 24 - 0
wwwroot/mes/rpt/rpt.ashx

@@ -682,7 +682,31 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                         }
                         break;
                     }
+                case "getDefectGroupName":
+                    {
+                        //获取每窑  全部 
+                        using (IDataAccess conn = DataAccess.Create())
+                        {
+                            DataTable dt = conn.ExecuteDatatable(@"
+                                SELECT DISTINCT DEFECTGROUPTYPE
+                                           ,DEFECTGROUPNAME
+                              FROM tp_mst_defectgroup t
+                             WHERE defectgrouptype LIKE '%每窑%'
+                               AND defectgrouptype != '每窑4'
+                               AND valueflag = '1'
+                               AND accountid = @ACCOUNTID@
+                             ORDER BY defectgrouptype
+                            ",
+                                new CDAParameter("ACCOUNTID", accountId)
+                                );
 
+                            if (context.Request["select"] is object)
+                                context.Response.Write(dt.ToJson());
+                            else
+                                context.Response.Write(new JsonResult(dt).ToJson());
+                        }
+                        break;
+                    }
 
                 default:
                     {

+ 63 - 0
wwwroot/mes/rpt/rpt014/rpt_index_detail.html

@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8" />
+    <meta name="keywords" content="dongke,mes,ibossmes">
+    <meta name="description" content="制造企业生产过程执行管理系统">
+    <meta name="author" content="xuwei">
+    <title>东科软件</title>
+    <script src="/plugins/xeasyui/xeasyui.min.js"></script>
+</head>
+<body class="easyui-layout">
+    <div data-options="region:'center',plain:true,border:false">
+        <!--表格-->
+        <table class="easyui-datagrid"
+               id="DataGridMasterGrid"
+               data-options="toolbar: '#tb',method:'get',border:false,singleSelect:true,fit:true,fitColumns:true">
+            <thead>
+            </thead>
+        </table>
+    </div>
+    
+    <script type="text/javascript"> 
+
+        function cancelForm() {
+            $.dialog.close();
+        }
+        function getQueryParams() {
+            let params = {};
+            let queryString = window.location.search.substring(1); // 获取查询字符串并去掉前面的问号
+            let pairs = queryString.split("&"); // 将查询字符串分割成键值对数组
+            for (let pair of pairs) {
+                let [key, value] = pair.split("="); // 将键值对分割成键和值
+                params[key] = decodeURIComponent(value); // 对值进行URL解码
+            }
+            return params;
+        }
+
+        let params = getQueryParams();
+        console.log(params); // {param1: "value1", param2: "value2"}
+
+ 
+        
+        $(document).ready(function () {
+            let params = getQueryParams();
+            console.log(params); // {param1: "value1", param2: "value2"}
+
+            //传入的参数
+            let queryParams = JSON.parse(localStorage.getItem("SearchSubmit"));
+            console.log(queryParams);
+            $('#DataGridMasterGrid').datagridLoadRpt({
+                title: '',
+                idField: 'SID',
+                queryParams: queryParams,
+                url: 'rptnew_detail.ashx?fields=' + params["fields"] + "&index=" + params["index"] + "&gs=" + params["gs"]  ,
+                fixWidth: 280,
+                mergeWidth: 80,
+                splitChar: '_'
+            });
+        });
+
+    </script>
+</body>
+</html>

+ 78 - 37
wwwroot/mes/rpt/rpt014/rpt_index_new.html

@@ -40,9 +40,12 @@
                             &nbsp; 产品名称
                             <input class="easyui-combobox" id="goodsnameMaster" name="goodsnameMaster" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getGoods&select=1',method:'get',valueField:'GOODSNAME',textField:'GOODSNAME',panelHeight:'300px',editable:'true'" style="width: 150px; height: 32px;">
                         </span>
-                 
+                    </div>
+                    <div style="margin-top:10px;margin-left:-15px;">
                         <input class="easyui-checkbox" id="chkMonitor" name="chkMonitor" label="结转查询" labelAlign="right" data-options="onChange:tbChangeState" />
-                     
+                        可选缺陷列:
+                        <input class="easyui-combobox" id="defectMaster" name="defectMaster" data-options="required:false,prompt:'',tipPosition:'top',url:'../rpt.ashx?m=getDefectGroupName&select=1',method:'get',valueField:'DEFECTGROUPNAME',textField:'DEFECTGROUPNAME',panelHeight:'200px',editable:'true',multiple:true,onChange:tbChangeDefect" style="width:140px;height:32px;">
+
                         <a href="javascript:void(0)" id="btnSearchSubmit" title="清空" class="easyui-linkbutton" plain="false" onclick="$('#ffMaster').form('clear')">清空</a>
                         <a href="javascript:void(0)" id="btnSearchSubmit" title="搜索" class="easyui-linkbutton" plain="false" onclick="tbSearchSubmit()">搜索</a>
                     </div>
@@ -57,68 +60,96 @@
             </thead>
         </table>
     </div>
-     
+
 
     <script type="text/javascript">
-        t=1
+        var name = "";
+        t = 1
         $(document).ready(function () {
+            localStorage.removeItem("SearchSubmit");
             var ctime = new Date();
             var beginDate = ctime.getFullYear() + "-" + (ctime.getMonth() + 1) + "-" + ctime.getDate() + " 00:00:00";
             var endDate = ctime.getFullYear() + "-" + (ctime.getMonth() + 1) + "-" + ctime.getDate() + " 23:59:59";
             $("#datebeginMaster").datetimebox("setValue", beginDate);
             $("#dateendMaster").datetimebox("setValue", endDate);
+            getUserDefectGroupNameData();
         });
 
-        //加载子表数据
-        function LoadDataGridDetail(index, row) {
-       
-            
-        }
 
+        //手动加载数据
+        function getUserDefectGroupNameData() {  
+            $.post('rptdefectuser.ashx?m=master', null, function (data) {
+                var row = JSON.parse(data);
+                if (row["success"] == true) {                  
+                    if (row.rows != null && row.rows.length > 0) {                        
+                        for (var i = 0; i < row.rows.length; i++) { 
+                            name += row.rows[i]["DEFECTGROUPNAME"] + ",";
+                        } 
+                        name = name.substring(0, name.length - 1);
+                        $('#defectMaster').combobox('setValue', row.rows);
+                        $('#defectMaster').combobox('setText', name);
+                    } else {
+                        //$("#defectMaster").val("");
+                        $('#defectMaster').combobox('setValue', "");
+                        $('#defectMaster').combobox('setText', '');
+                    }
+                    console.log("getUserDefectGroupNameData",name)
+                }              
+
+            });
+        }
+ 
         //搜索提交
-        function tbSearchSubmit() { 
-			var isNotcheck = 0;
-			if ($('#chkNotHave').checkbox('options').checked) {
-				isNotcheck = 1;
-			}
+        function tbSearchSubmit() {
+            var isNotcheck = 0;
+            if ($('#chkNotHave').checkbox('options').checked) {
+                isNotcheck = 1;
+            }
+            // 查询条件的暂存
+            localStorage.setItem("SearchSubmit", JSON.stringify($('#ffMaster').serializeJson()));
+            // 插入查询缺陷的条件  
             if ($('#ffMaster').form("validate")) {
                 if ($('#chkMonitor').checkbox('options').checked) {
                     $('#DataGridMasterGrid').datagridLoadRpt({
                         title: '',
                         idField: 'SID',
                         queryParams: $('#ffMaster').serializeJson(),
-						url: 'rptnew.ashx?m=jiezhauang&id=' + request('id') + '&isNotcheck=' + isNotcheck,
+                        url: 'rptnew.ashx?m=jiezhauang&id=' + request('id') + '&isNotcheck=' + isNotcheck + '&name=' + name,
                         fixWidth: 140,
                         mergeWidth: 80,
                         splitChar: '_'
                     });
-                    t=1
+                    t = 1
                 }
                 else {
                     $('#DataGridMasterGrid').datagridLoadRpt({
                         title: '',
                         idField: 'SID',
                         queryParams: $('#ffMaster').serializeJson(),
-						url: 'rptnew.ashx?m=master&id=' + request('id') + '&isNotcheck=' + isNotcheck,
+                        url: 'rptnew.ashx?m=master&id=' + request('id') + '&isNotcheck=' + isNotcheck + '&name=' + name,
                         fixWidth: 140,
                         mergeWidth: 80,
                         splitChar: '_'
                     });
-                    t=2
+                    t = 2
                 }
             }
         }
 
-       // 2021-6-11 dongyan  添加 结转数据开关 选择结转测试复选框 将除时间外的条件禁用
+        // 2021-6-11 dongyan  添加 结转数据开关 选择结转测试复选框 将除时间外的条件禁用
         function tbChangeState(checked) {
-			if (checked) {
-				document.getElementById("jz").style.display = 'none';	// 隐藏选择的元素
-			} else {
-				document.getElementById("jz").style.display = '';	// 显示隐藏的元素
-			}
-           $("#datebeginMaster").DateTimeBox2YearMonthBox(checked);
-           $("#dateendMaster").DateTimeBox2YearMonthBox(checked);
-       }
+            if (checked) {
+                document.getElementById("jz").style.display = 'none';	// 隐藏选择的元素
+            } else {
+                document.getElementById("jz").style.display = '';	// 显示隐藏的元素
+            }
+            $("#datebeginMaster").DateTimeBox2YearMonthBox(checked);
+            $("#dateendMaster").DateTimeBox2YearMonthBox(checked);
+        }
+
+        function tbChangeDefect(e) {
+            console.log("tbChangeDefect",e);
+        }
 
         //导出
         function tbExport() {
@@ -170,19 +201,29 @@
         // 点击某行某列
         function dgDblclickcelldetail(index, fields, value) {
             var row = $('#DataGridMasterGrid').datagrid('getRows')[index];
-            console.log(index, fields, value, row, row["产品名称"]);
-
+            console.log(index, fields, value, row, row["产品名称"], JSON.stringify($('#ffMaster').serializeJson()));
+            if (row["产品名称"] == null || row["产品名称"] == "") {
+                return;
+            }
+            if (fields == "出窑数" || fields == "U级" || fields == "A级" || fields == "AA级" || fields == "去AA" || fields == "F级" || fields == "R级") {
+                $('#DataGridMasterGrid').datagridDialog({
+                    title: '详细',
+                    width: 640,
+                    height: 480,
+                    url: 'rpt_index_detail.html?fields=' + fields + "&index=" + index + "&gs=" + row["产品编码"]
+                });
+            }
         }
 
     </script>
 
-     <style type="text/css"> 
-         #DataGridMasterGrid th:first-child, td:not([field="原料缺陷_铁脏"]):first-child {
-             position: sticky;
-             left: 0;
-             z-index: 100;
-             background-color: gray;
-         } 
-     </style>
+    <style type="text/css">
+        #DataGridMasterGrid th:first-child, td:not([field="原料缺陷_铁脏"]):first-child {
+            position: sticky;
+            left: 0;
+            z-index: 100;
+            background-color: gray;
+        }
+    </style>
 </body>
 </html>

+ 94 - 0
wwwroot/mes/rpt/rpt014/rptdefectuser.ashx

@@ -0,0 +1,94 @@
+<%@ WebHandler Language="C#" Class="rpt" %>
+
+using System;
+using System.Web;
+using System.Web.SessionState;
+using System.Data;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Curtain.DataAccess;
+using DK.XuWei.WebMes;
+
+public class rpt : IHttpHandler, IReadOnlySessionState
+{
+    List<CDAParameter> goodsnull = new List<CDAParameter>();
+    string[] goodsCodes = new string[] { };
+    string goodsStr = "";
+    DataTable goodsTable = new DataTable();
+    string defectStr = "";
+    DataTable col = new DataTable();
+    string proc = "";
+    string sqlStr = "";
+    //楼号
+    string buding = null;
+    public void ProcessRequest(HttpContext context)
+    {
+        //主表
+        if (context.Request["m"].ToString() == "master")
+        {
+            using (IDataAccess conn = DataAccess.Create())
+            {
+                //读取报表数据
+                sqlStr = @" SELECT DEFECTGROUPNAME
+                  FROM tp_mst_defectgroup_user
+                 WHERE accountid = @ACCOUNTID@
+                   AND userid = @USERID@ ";
+
+                //获取查询条件
+                List<CDAParameter> sqlPara = new List<CDAParameter>();
+                sqlPara.Add(new CDAParameter("ACCOUNTID", HttpContext.Current.Session["accountId"]));
+                sqlPara.Add(new CDAParameter("USERID", HttpContext.Current.Session["userId"]));
+
+                DataTable dt = conn.ExecuteDatatable(sqlStr, sqlPara.ToArray());
+                ;
+                //获取分页数据
+                int total = 0;
+                string jsonStr = new JsonResult(dt) { total = total }.ToJson();
+                context.Response.Write(jsonStr);
+            }
+        }
+        if (context.Request["m"].ToString() == "insert")
+        { 
+            if (context.Request["defectMaster"] is object)
+            {
+                if(context.Request["defectMaster"].ToString()!="")
+                {
+                    string[] denames = context.Request["defectMaster"].ToString().Split(',');
+                }
+
+            }
+            using (IDataAccess conn = DataAccess.Create())
+            {
+                int result = conn.ExecuteNonQuery(@"
+                INSERT INTO tp_mst_defectgroup_user ( 
+                    DEFECTGROUPTYPE,
+                    DEFECTGROUPNAME, 
+                    ACCOUNTID,CREATEUSERID,USERID
+                ) VALUES ( 
+                    @DEFECTGROUPTYPE@,
+                    @DEFECTGROUPNAME@,                    
+                    @ACCOUNTID@,@CREATEUSERID@,@USERID@
+                )
+                ",
+               //new CDAParameter("DEFECTGROUPTYPE", form["DEFECTGROUPNAME"].ToString()),
+               //new CDAParameter("DEFECTGROUPNAME", form["DEFECTGROUPNAME"].ToString()),
+               new CDAParameter("ACCOUNTID", HttpContext.Current.Session["accountId"].ToString()),
+               new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"].ToString()),
+               new CDAParameter("USERID", HttpContext.Current.Session["userId"].ToString())
+            );
+
+            }
+        }
+    }
+
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
+}

+ 279 - 32
wwwroot/mes/rpt/rpt014/rptnew.ashx

@@ -24,10 +24,13 @@ public class rpt : IHttpHandler, IReadOnlySessionState
     string sqlStr = "";
     //楼号
     string buding = null;
+    List<string> defectallnames = new List<string> { "原料缺陷", "成型缺陷", "施釉缺陷", "出装窑缺陷", "烧窑缺陷", "其他缺陷", "研磨缺陷" };
+
     public void ProcessRequest(HttpContext context)
     {
         context.Response.ContentType = "text/plain";
         proc = context.Request["procedureidMaster"].ToString();
+
         //主表
         if (context.Request["m"].ToString() == "master")
         {
@@ -83,13 +86,75 @@ public class rpt : IHttpHandler, IReadOnlySessionState
             {
                 buding = "IN(" + "'1#','2#'" + ")";
             }
+            //d可选缺陷  删除 插入
+            string[] denames = new string[] { };
+            if (context.Request["defectMaster[]"] is object)
+            {
+                if (context.Request["defectMaster[]"].ToString() != "")
+                {
+                    denames = context.Request["defectMaster[]"].ToString().Split(',');
+                }
+            }
+            if (context.Request["defectMaster"] is object)
+            {
+                if (context.Request["defectMaster"].ToString() != "")
+                {
+                    denames = context.Request["defectMaster"].ToString().Split(',');
+                }
+
+            }
+            // 判断可选缺陷 是否发生变化,如果没有变化则不用调用数据库
+            bool flg = true;
+            for (int i = 0; i < denames.Length; i++)
+            {
+                // 前台传过来的 可选缺陷的字符串
+                if (!context.Request["name"].ToString().Contains(denames[i]))
+                {
+                    flg = false;
+                }
+            }
+			//d可选缺陷  删除 插入
+            if (!flg)
+            {
+                using (IDataAccess conn = DataAccess.Create())
+                {
+                    conn.ExecuteNonQuery(@"delete from tp_mst_defectgroup_user where USERID = @USERID@",
+                        new CDAParameter("USERID", HttpContext.Current.Session["userId"].ToString()));
+
+                    for (int i = 0; i < denames.Length; i++)
+                    {
+                        if (string.IsNullOrEmpty(denames[i]))
+                        {
+                            continue;
+                        }
+                        defectallnames.Remove(denames[i]);
+                        int result = conn.ExecuteNonQuery(@"
+					INSERT INTO tp_mst_defectgroup_user ( 
+						DEFECTGROUPTYPE,
+						DEFECTGROUPNAME, 
+						ACCOUNTID,CREATEUSERID,USERID
+					) VALUES ( 
+						@DEFECTGROUPTYPE@,
+						@DEFECTGROUPNAME@,                    
+						@ACCOUNTID@,@CREATEUSERID@,@USERID@
+					)
+					",
+                       new CDAParameter("DEFECTGROUPTYPE", denames[i]),
+                       new CDAParameter("DEFECTGROUPNAME", denames[i]),
+                       new CDAParameter("ACCOUNTID", HttpContext.Current.Session["accountId"].ToString()),
+                       new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"].ToString()),
+                       new CDAParameter("USERID", HttpContext.Current.Session["userId"].ToString())
+                    );
+                    }
+                }
+            }
             using (IDataAccess conn = DataAccess.Create())
             {
                 col = conn.ExecuteDatatable(@"
 					SELECT
 						DG.DEFECTGROUPTYPE AS TNO,
 						DG.DEFECTGROUPID AS DNO,
-						DG.DEFECTGROUPNAME || '_' || D.DEFECTNAME AS DEFECT 
+						(case when INSTR(to_char(dg.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(dg.defectgroupname) end ) || '_' || to_char(D.DEFECTNAME) AS DEFECT 
 					FROM
 						TP_MST_DEFECTGROUP DG
 						LEFT JOIN TP_MST_DEFECT D ON DG.DEFECTID = D.DEFECTID 
@@ -100,12 +165,12 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 					SELECT
 						DG.DEFECTGROUPTYPE AS TNO,
 						9999 AS DNO,
-						DG.DEFECTGROUPNAME || '_合计' AS DEFECT 
+						(case when INSTR(to_char(dg.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(dg.defectgroupname) end ) || '_合计' AS DEFECT 
 					FROM
 						(select * from TP_MST_DEFECTGROUP WHERE DEFECTGROUPTYPE LIKE '每窑%') DG
 					GROUP BY 
 						DG.DEFECTGROUPTYPE,
-						DG.DEFECTGROUPNAME
+						(case when INSTR(to_char(dg.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(dg.defectgroupname) end )
 
 					ORDER BY
 						TNO,DNO
@@ -236,13 +301,13 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 			              TT.CNUM 
 					 FROM (SELECT grouping_id(ppp.goodstypecode
                                                ,ppp.goodscode
-                                               ,ppp.defectgroupname
+                                               ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
                                                ,ppp.defectname) AS gid
                                    ,ppp.goodstypecode
                                    ,ppp.goodstypename
                                    ,ppp.goodscode
-                                   ,ppp.defectgroupname
-                                   ,to_char(ppp.defectgroupname || '_' || ppp.defectname) AS defect
+                                   ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
+                                   ,to_char((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ) || '_' || ppp.defectname) AS defect
                                    ,SUM(CASE
                                             WHEN ppp.defectid = 11
                                                  AND (ppp.goodsleveltypeid = 4 OR ppp.goodsleveltypeid = 5) THEN
@@ -300,17 +365,17 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                             AND L.BUILDINGNO {BUILDINGNO} ) ppp
 				            --XUWEI 2020-07-10 ADD
 				            --AND (NOT D.DEFECTPROCEDUREID IS NULL)
-			            GROUP BY GROUPING SETS((ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, ppp.defectgroupname, ppp.defectname),
-                              (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, ppp.defectgroupname),
+			            GROUP BY GROUPING SETS((ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+                              (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),
                               (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode),
-                              (ppp.goodstypecode, ppp.goodstypename, ppp.defectgroupname, ppp.defectname),
-                              (ppp.goodstypecode, ppp.goodstypename, ppp.defectgroupname),
+                              (ppp.goodstypecode, ppp.goodstypename, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+                              (ppp.goodstypecode, ppp.goodstypename, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),
                               (ppp.goodstypecode, ppp.goodstypename),
-                              (ppp.defectgroupname, ppp.defectname),
-                              (ppp.defectgroupname),())
+                              ((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+                              ((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),())
                               ORDER BY ppp.goodstypecode
                                       ,ppp.goodscode
-                                      ,ppp.defectgroupname
+                                      ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
                                       ,ppp.defectname) tt) 
 			             PIVOT (
 			            SUM( CNUM ) FOR DEFECT IN ({DEFECT},'合计' AS 合计 
@@ -326,7 +391,7 @@ public class rpt : IHttpHandler, IReadOnlySessionState
 				ORDER BY TA.GOODSTYPENAME,TA.GOODSCODE
                 ".Replace("{DEFECT}", defectStr).Replace("{BUILDINGNO}", buding).Replace("{goodsCodes}", goodssql);
                 }
-                else
+                else if (proc == "35")
                 {
                     //读取报表数据
                     sqlStr = @"
@@ -439,13 +504,13 @@ DECODE( TA.GID, 3, '合计', TA.GOODSTYPENAME ) AS 产品类别,
 			              TT.CNUM 
 					FROM (SELECT grouping_id(ppp.goodstypecode
                                                ,ppp.goodscode
-                                               ,ppp.defectgroupname
+                                               ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
                                                ,ppp.defectname) AS gid
                                    ,ppp.goodstypecode
                                    ,ppp.goodstypename
                                    ,ppp.goodscode
-                                   ,ppp.defectgroupname
-                                   ,to_char(ppp.defectgroupname || '_' || ppp.defectname) AS defect
+                                   ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
+                                   ,to_char((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ) || '_' || ppp.defectname) AS defect
                                    ,SUM(CASE
                                             WHEN ppp.defectid = 11
                                                  AND (ppp.goodsleveltypeid = 4 OR ppp.goodsleveltypeid = 5) THEN
@@ -500,17 +565,17 @@ DECODE( TA.GID, 3, '合计', TA.GOODSTYPENAME ) AS 产品类别,
                             AND L.BUILDINGNO {BUILDINGNO}) ppp
 				            --XUWEI 2020-07-10 ADD
 				            --AND (NOT D.DEFECTPROCEDUREID IS NULL)
-			            GROUP BY GROUPING SETS((ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, ppp.defectgroupname, ppp.defectname),
-                              (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, ppp.defectgroupname),
+			            GROUP BY GROUPING SETS((ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+                              (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),
                               (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode),
-                              (ppp.goodstypecode, ppp.goodstypename, ppp.defectgroupname, ppp.defectname),
-                              (ppp.goodstypecode, ppp.goodstypename, ppp.defectgroupname),
+                              (ppp.goodstypecode, ppp.goodstypename, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+                              (ppp.goodstypecode, ppp.goodstypename, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),
                               (ppp.goodstypecode, ppp.goodstypename),
-                              (ppp.defectgroupname, ppp.defectname),
-                              (ppp.defectgroupname),())
+                              ((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+                              ((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),())
                               ORDER BY ppp.goodstypecode
                                       ,ppp.goodscode
-                                      ,ppp.defectgroupname
+                                      ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
                                       ,ppp.defectname) tt) PIVOT (
 			            SUM( CNUM ) FOR DEFECT IN ({DEFECT},'合计' AS 合计 
 			            ) 
@@ -525,6 +590,185 @@ DECODE( TA.GID, 3, '合计', TA.GOODSTYPENAME ) AS 产品类别,
 				ORDER BY TA.GOODSTYPENAME,TA.GOODSCODE
                 ".Replace("{DEFECT}", defectStr).Replace("{BUILDINGNO}", buding).Replace("{goodsCodes}", goodssql);
                 }
+                else
+                {
+                    //读取报表数据
+                    sqlStr = @" SELECT 
+						TA.GOODSNAME AS 产品名称,
+						TA.GOODSCODE AS 产品编码,
+						DECODE( TA.GID, 3, '合计', TA.GOODSTYPENAME ) AS 产品类别,  
+						DECODE( TA.COUNT_AA, 0, NULL, TA.COUNT_AA ) AS AA级, 
+						DECODE(TA.COUNT_L, 0, NULL, TA.COUNT_L) AS 去AA
+						,DECODE(ta.count_ym, 0, NULL, ta.count_ym) AS 研磨
+						,DECODE(ta.count_lb, 0, NULL, ta.count_lb) AS 直接冷补
+						,DECODE(ta.count_ymlb, 0, NULL, ta.count_ymlb) AS 研磨后冷补
+						,DECODE(ta.count_dlq, 0, NULL, ta.count_dlq) AS 堵漏气
+						,DECODE(ta.count_sxbl, 0, NULL, ta.count_sxbl) AS 刷洗不良 
+						,DECODE( TA.Waste, 0, NULL, TA.Waste ) AS F级,						 
+						TD.* 
+					FROM
+							(
+							SELECT
+							   GROUPING_ID ( GT.GOODSTYPECODE, G.GOODSCODE ) GID,
+								GT.GOODSTYPECODE,
+								GT.GOODSTYPENAME,
+								G.GOODSCODE,
+								G.GOODSNAME,  
+								SUM( CASE WHEN T.H_FLAG = 0 AND T.GOODSLEVELTYPEID = 7 THEN 1 ELSE 0 END ) COUNT_U7, -- 直接次品
+								SUM( CASE WHEN  rpd.procedureid = 20 THEN 1 ELSE 0 END ) AS  count_ym , --研磨  
+								SUM( CASE WHEN  rpd.procedureid = 22 THEN 1 ELSE 0 END ) AS  count_lb ,--直接冷补, 
+								SUM( CASE WHEN  rpd.procedureid = 23 THEN 1 ELSE 0 END ) AS  count_ymlb, --研磨后冷补, 
+								SUM( CASE WHEN  rpd.procedureid = 37 THEN 1 ELSE 0 END ) AS   count_dlq ,--堵漏气, 
+								SUM( CASE WHEN  rpd.procedureid = 41 THEN 1 ELSE 0 END ) AS  count_sxbl, --刷洗不良,
+								SUM( CASE WHEN RPD.PROCEDUREID IN ( 22, 23, 37, 20, 41 ) THEN  1 ELSE 0 END ) COUNT_L, -- 研磨、堵漏气、刷洗不良、直接冷补、研磨冷补
+								SUM( CASE WHEN T.GOODSLEVELTYPEID IN ( 4, 5 ) AND RPD.PROCEDUREID IN ( 22, 23, 37, 20, 41 ) THEN 1 ELSE 0 END ) COUNT_AA, -- 研磨、堵漏气、刷洗不良、直接冷补、研磨冷补合格数
+								SUM( CASE WHEN T.H_FLAG = 0 AND T.GOODSLEVELTYPEID = 20 THEN 1 ELSE 0 END ) Waste -- 直接次品
+							FROM
+								(
+								 
+								SELECT
+										TO_CHAR(PD.PRODUCTIONDATAID),
+										MAX( PMAX.PRODUCTIONDATAID ) MPDID,
+										PD.GOODSLEVELTYPEID,
+										PD.GOODSID,
+										PD.REWORKPROCEDUREID,
+										0 LB_NUM,
+										0 B_NUM, 
+										0 OUT_K,
+										CASE WHEN sum( PMAX.PRODUCTIONDATAID ) > 0 THEN 1 ELSE 0 END H_FLAG, 
+										0 Waste
+								FROM
+									TP_PM_PRODUCTIONDATA PD
+									LEFT JOIN TP_PM_PRODUCTIONDATA PMAX ON PMAX.GROUTINGDAILYDETAILID = PD.GROUTINGDAILYDETAILID 
+									AND PMAX.PRODUCTIONDATAID < PD.PRODUCTIONDATAID AND PMAX.VALUEFLAG = '1' AND PMAX.PROCEDUREMODEL = '1'
+									/*20  研磨 22  直接冷补 23  研磨后冷补(非回收) 37  堵漏气 41  刷洗不良*/
+									AND PMAX.PROCEDUREID IN (20, 22, 23, 37, 41)
+				            
+									INNER JOIN TP_PC_GROUTINGLINE GL ON GL.GROUTINGLINEID = PD.GROUTINGLINEID 
+								WHERE
+								   PD.VALUEFLAG = '1'
+								   AND PD.PROCEDUREID in ( 13 ,35)
+								   AND PD.CHECKBATCHNO = 1
+								   AND PD.CREATETIME >= @DATEBEGIN@
+								   AND PD.CREATETIME < @DATEEND@
+								   AND (PD.KILNID = @KILNID@ OR @KILNID@ IS NULL) 
+									AND PD.GOODSCODE IN({goodsCodes})
+								   AND GL.BUILDINGNO {BUILDINGNO}
+								GROUP BY
+									PD.PRODUCTIONDATAID,
+									PD.GOODSLEVELTYPEID,
+									PD.GOODSID,
+									PD.REWORKPROCEDUREID                              
+									) T
+								LEFT JOIN TP_PM_PRODUCTIONDATA RPD ON RPD.PRODUCTIONDATAID = T.MPDID
+								INNER JOIN TP_MST_GOODS G ON G.GOODSID = T.GOODSID
+								INNER JOIN TP_MST_GOODSTYPE GT ON GT.GOODSTYPEID = G.GOODSTYPEID 
+								GROUP BY
+									GROUPING SETS ( ( GT.GOODSTYPECODE, GT.GOODSTYPENAME, G.GOODSCODE, G.GOODSNAME ), ( GT.GOODSTYPECODE, GT.GOODSTYPENAME ), ( ) ) 
+									) TA
+						LEFT JOIN (
+						SELECT
+							* 
+						FROM
+							(
+								SELECT
+									CASE WHEN TT.GID IN ( 12, 13, 15 ) THEN 3 WHEN TT.GID IN ( 4, 5, 7 ) THEN 1 ELSE 0 END AS D_GID,
+									TT.GOODSTYPECODE D_GOODSTYPECODE, --,TT.GOODSTYPENAME D_
+									TT.GOODSCODE D_GOODSCODE,
+									CASE WHEN TT.GID IN ( 1, 5, 13 ) THEN TT.DEFECT || '合计' WHEN TT.GID IN ( 3, 7, 15 ) THEN '合计' ELSE TT.DEFECT END AS DEFECT,
+								  TT.CNUM 
+							 FROM (SELECT grouping_id(ppp.goodstypecode
+													   ,ppp.goodscode
+													   ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
+													   ,ppp.defectname) AS gid
+										   ,ppp.goodstypecode
+										   ,ppp.goodstypename
+										   ,ppp.goodscode
+										   ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
+										   ,to_char((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ) || '_' || ppp.defectname) AS defect
+										   ,SUM(CASE
+													WHEN ppp.defectid = 11
+														 AND (ppp.goodsleveltypeid = 4 OR ppp.goodsleveltypeid = 5) THEN
+													 0
+													ELSE
+													 1
+												END) AS cnum
+                             
+									   FROM (SELECT DISTINCT gt.goodstypecode
+															,gt.goodstypename
+															,g.goodscode
+															,pdp.defectgroupname
+															,to_char(pdp.defectgroupname || '_' ||
+																	 m.defectname) AS defect
+															,d.defectid
+															,m.defectname
+															,p.goodsleveltypeid
+															,pp.productiondataid
+								 FROM
+									TP_PM_PRODUCTIONDATA P
+									-- 缺陷工序分组的 工序id1 工序id2 对应
+									inner join   tp_pm_productiondata pp on p.groutingdailydetailid = pp.groutingdailydetailid  and pp.valueflag = '1'
+                               
+									INNER JOIN TP_MST_GOODS G ON G.GOODSID = P.GOODSID
+									INNER JOIN TP_MST_GOODSTYPE GT ON GT.GOODSTYPEID = G.GOODSTYPEID
+									INNER JOIN TP_PC_GROUTINGLINE L ON P.GROUTINGLINEID = L.GROUTINGLINEID
+									INNER JOIN TP_PM_DEFECT D ON P.PRODUCTIONDATAID = D.PRODUCTIONDATAID --AND (P.GOODSLEVELTYPEID NOT IN (4, 5) OR D.DEFECTID <> 11)
+									INNER JOIN TP_MST_DEFECT M ON ( M.DEFECTID = D.DEFECTID AND M.DEFECTID > 0 )
+									LEFT JOIN TP_PC_PROCEDURE PR ON PR.PROCEDUREID = D.DEFECTPROCEDUREID
+									INNER JOIN TP_MST_DEFECTGROUP PDP ON PDP.DEFECTID = D.DEFECTID AND PDP.DEFECTGROUPTYPE LIKE '每窑%'
+									AND ( 
+ 
+											-- ( PDP.PROCEDUREID1 = PR.PROCEDUREID OR PDP.PROCEDUREID2 = PR.PROCEDUREID )
+											--xuwei 2020-09-01 add 重烧的没有责任工序也算
+											-- OR @PROCEDUREID@ = 35
+											-- 20250417 改为用 是否走过 tp_mst_defectgroup 缺陷工序分组的 工序id1 工序id2 为基准
+											pdp.procedureid1 = pp.procedureid OR pdp.procedureid2 = pp.procedureid
+										) 
+								WHERE
+									P.VALUEFLAG = '1'
+									AND P.PROCEDUREID = @PROCEDUREID@
+									AND P.CHECKBATCHNO = 1
+									--xuwei fix 2020-10-09 begin
+									AND P.CHECKTIME >= @DATEBEGIN@
+									AND P.CHECKTIME < @DATEEND@
+									--AND P.CREATETIME >= @DATEBEGIN@
+									--AND P.CREATETIME < @DATEEND@
+									--xuwei fix 2020-10-09 end 
+
+									AND P.GOODSLEVELTYPEID <> 4
+									AND (P.KILNID = @KILNID@ OR @KILNID@ IS NULL)
+									-- AND (P.GOODSCODE = @GOODSCODE@ OR @GOODSCODE@ IS NULL)
+									--AND (INSTR((@GOODSCODE@),P.GOODSCODE)>0 OR @GOODSCODE@ IS NULL)
+									 AND P.GOODSCODE IN({goodsCodes})
+									AND L.BUILDINGNO {BUILDINGNO} ) ppp
+									--XUWEI 2020-07-10 ADD
+									--AND (NOT D.DEFECTPROCEDUREID IS NULL)
+								GROUP BY GROUPING SETS((ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+									  (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),
+									  (ppp.goodstypecode, ppp.goodstypename, ppp.goodscode),
+									  (ppp.goodstypecode, ppp.goodstypename, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+									  (ppp.goodstypecode, ppp.goodstypename, (case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),
+									  (ppp.goodstypecode, ppp.goodstypename),
+									  ((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end ), ppp.defectname),
+									  ((case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )),())
+									  ORDER BY ppp.goodstypecode
+											  ,ppp.goodscode
+											  ,(case when INSTR(to_char(ppp.defectgroupname), '施釉缺陷') > 0 then '施釉缺陷' else  to_char(ppp.defectgroupname) end )
+											  ,ppp.defectname) tt) 
+								 PIVOT (
+								SUM( CNUM ) FOR DEFECT IN ({DEFECT},'合计' AS 合计 
+								) 
+							) 
+						) TD ON TA.GID = TD.D_GID 
+						AND 
+						(
+							( TA.GID = 0 AND TA.GOODSTYPECODE = TD.D_GOODSTYPECODE AND TA.GOODSCODE = TD.D_GOODSCODE ) 
+							OR ( TA.GID = 1 AND TA.GOODSTYPECODE = TD.D_GOODSTYPECODE ) 
+							OR ( TA.GID = 3 ) 
+						)
+						ORDER BY TA.GOODSTYPENAME,TA.GOODSCODE
+						".Replace("{DEFECT}", defectStr).Replace("{BUILDINGNO}", buding).Replace("{goodsCodes}", goodssql);
+                }
 
                 //获取查询条件
                 List<CDAParameter> sqlPara = new List<CDAParameter>();
@@ -636,11 +880,16 @@ DECODE( TA.GID, 3, '合计', TA.GOODSTYPENAME ) AS 产品类别,
                         }
                     }
                 }
-                //获取分页参数
-                //int page = HttpContext.Current.Request["page"] is object ? Convert.ToInt32(HttpContext.Current.Request["page"]) : 1;
-                //int rows = HttpContext.Current.Request["rows"] is object ? Convert.ToInt32(HttpContext.Current.Request["rows"]) : 10;
-                //string sort = HttpContext.Current.Request["sort"] is object ? HttpContext.Current.Request["sort"] : "m.REPORTCODE";
-                //string order = HttpContext.Current.Request["order"] is object ? HttpContext.Current.Request["order"] : "";
+                for (int m = dt.Columns.Count - 1; m > 0; m--)
+                {
+                    for (int mn = 0; mn < defectallnames.Count; mn++)
+                    {
+                        if (dt.Columns[m].ColumnName.Contains(defectallnames[mn]))
+                        {
+                            dt.Columns.Remove(dt.Columns[m].ColumnName);
+                        }
+                    }
+                }
                 //获取分页数据
                 int total = 0;
                 //dt = conn.SelectPages(page, rows, out total, sqlStr, sqlPara.ToArray());
@@ -649,9 +898,7 @@ DECODE( TA.GID, 3, '合计', TA.GOODSTYPENAME ) AS 产品类别,
                 context.Response.Write(jsonStr);
             }
         }
-
-
-
+        // 结转
         if (context.Request["m"].ToString() == "jiezhauang")
         {
             using (IDataAccess conn = DataAccess.Create())

+ 181 - 0
wwwroot/mes/rpt/rpt014/rptnew_detail.ashx

@@ -0,0 +1,181 @@
+<%@ WebHandler Language="C#" Class="rptnew_detail" %>
+
+using System;
+using System.Web;
+using System.Web.SessionState;
+using System.Data;
+using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Curtain.DataAccess;
+using DK.XuWei.WebMes;
+
+public class rptnew_detail : IHttpHandler, IReadOnlySessionState
+{
+    List<CDAParameter> goodsnull = new List<CDAParameter>();
+    string[] goodsCodes = new string[] { };
+    string goodsStr = "";
+    DataTable goodsTable = new DataTable();
+    string defectStr = "";
+    DataTable col = new DataTable();
+    string proc = "";
+    string sqlStr = "";
+    //楼号
+    string buding = null;
+    public void ProcessRequest(HttpContext context)
+    {
+        context.Response.ContentType = "text/plain";
+        proc = context.Request["procedureidMaster"].ToString();
+        string fields = context.Request["fields"].ToString();
+        string index = context.Request["index"].ToString();
+        string gs = context.Request["gs"].ToString();
+        //GOODSCODE: ""
+        //buildingnoMaster: "12"
+        //datebeginMaster: "2025-01-06 00:00:00"
+        //dateendMaster: "2025-06-06 23:59:59"
+        //goodsnameMaster: ""
+        //kilnidMaster: ""
+        //procedureidMaster: "13"
+
+        #region 取缺陷拼接串
+        string procedureId = "21,2,6,16,31,25,30,33,7,8,9";
+        if (context.Request["buildingnoMaster"].ToString().IndexOf("2#") >= 0)
+        {
+            //二期 原料21 成型2 施釉6 循环线16     出装/登窑7 烧窑/入窑8 卸窑9
+            procedureId = "21,2,6,16,7,8,9";
+        }
+
+        if (context.Request["buildingnoMaster"].ToString().IndexOf("1#") >= 0)
+        {
+            //一期 原料31 成型25 施釉30 循环线33   出装/登窑7 烧窑/入窑8 卸窑9
+            procedureId = "31,25,30,33,7,8,9";
+        }
+
+
+        if (context.Request["buildingnoMaster"].ToString() != "12")
+        {
+            buding = "IN('" + context.Request["buildingnoMaster"] + "')";
+        }
+        else
+        {
+            buding = "IN(" + "'1#','2#'" + ")";
+        }
+        // 缺陷数据
+        using (IDataAccess conn = DataAccess.Create())
+        {
+            col = conn.ExecuteDatatable(@"
+					SELECT
+						DG.DEFECTGROUPTYPE AS TNO,
+						DG.DEFECTGROUPID AS DNO,
+						DG.DEFECTGROUPNAME || '_' || D.DEFECTNAME AS DEFECT 
+					FROM
+						TP_MST_DEFECTGROUP DG
+						LEFT JOIN TP_MST_DEFECT D ON DG.DEFECTID = D.DEFECTID 
+					WHERE 
+						DG.DEFECTGROUPTYPE LIKE '每窑%'
+					UNION
+
+					SELECT
+						DG.DEFECTGROUPTYPE AS TNO,
+						9999 AS DNO,
+						DG.DEFECTGROUPNAME || '_合计' AS DEFECT 
+					FROM
+						(select * from TP_MST_DEFECTGROUP WHERE DEFECTGROUPTYPE LIKE '每窑%') DG
+					GROUP BY 
+						DG.DEFECTGROUPTYPE,
+						DG.DEFECTGROUPNAME
+
+					ORDER BY
+						TNO,DNO
+					");
+
+            for (int i = 0; i < col.Rows.Count; i++)
+            {
+                if (defectStr.IndexOf("'" + col.Rows[i]["DEFECT"].ToString() + "'") < 0)
+                {
+                    if (i > 0) defectStr += ",";
+                    defectStr += "'" + col.Rows[i]["DEFECT"].ToString() + "' AS " + col.Rows[i]["DEFECT"].ToString();
+                }
+            }
+            #endregion
+            // 各个列的明细数据
+            string sqlDetail = "";
+            switch (fields)
+            {
+                case "出窑数":
+                    {
+                        sqlDetail = @" SELECT  DISTINCT '" + gs + @"' 产品编码, TO_CHAR(pd.Barcode)	产品条码				            
+			            FROM
+				            TP_PM_PRODUCTIONDATA PD
+				            INNER JOIN TP_PC_GROUTINGLINE GL ON GL.GROUTINGLINEID = PD.GROUTINGLINEID  
+				           
+			            WHERE
+                           PD.PROCEDUREID = @PROCEDUREID@
+                           AND PD.CHECKFLAG = 1
+                           AND PD.CREATETIME >= @DATEBEGIN@
+                           AND PD.CREATETIME < @DATEEND@
+                           AND (PD.KILNID = @KILNID@ OR @KILNID@ IS NULL) 
+                           AND PD.GOODSCODE IN( '" + gs + @"' )
+                           AND GL.BUILDINGNO {BUILDINGNO} ";
+                        break;
+                    }
+                case "U级":
+                    {
+                        break;
+                    }
+                case "A级":
+                    {
+                        break;
+                    }
+                case "AA级":
+                    {
+                        break;
+                    }
+                case "去AA":
+                    {
+                        break;
+                    }
+                case "F级":
+                    {
+                        break;
+                    }
+                case "R级":
+                    {
+                        break;
+                    }
+                default:
+                    {
+                        break;
+                    }
+
+            }
+            sqlDetail = sqlDetail.Replace("{DEFECT}", defectStr).Replace("{BUILDINGNO}", buding);
+            //获取查询条件
+            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"]).AddSeconds(1), DataType.DateTime));
+            sqlPara.Add(new CDAParameter("KILNID", context.Request["kilnidMaster"]));
+            sqlPara.Add(new CDAParameter("PROCEDUREID", context.Request["procedureidMaster"]));
+ 
+ 
+            DataTable dt = conn.ExecuteDatatable(sqlDetail, sqlPara.ToArray());
+
+
+            string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
+            //string jsonStr = new JsonResult(dt) { total = dt.Rows.Count }.ToJson();
+            context.Response.Write(jsonStr);
+        }
+
+
+    }
+
+    public bool IsReusable
+    {
+        get
+        {
+            return false;
+        }
+    }
+}