Browse Source

修复综合合格率分析表=>综合优等率=>成型线号不起作用
新增综合合格率分析表=>综合优等率 合计显示

李士越 1 năm trước cách đây
mục cha
commit
a87ebfafba
1 tập tin đã thay đổi với 20 bổ sung6 xóa
  1. 20 6
      wwwroot/mes/rpt/rpt135/rpt.ashx

+ 20 - 6
wwwroot/mes/rpt/rpt135/rpt.ashx

@@ -133,7 +133,7 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                     }
                     sqlStr += " order by g.goodscode";
                     sqlPara.Add(new CDAParameter("BUILDINGNO", context.Request["workshopcodeMaster"].ToString()));
-                    sqlPara.Add(new CDAParameter("HIGHPRESSUREFLAG",context.Request["HIGHPRESSUREFLAG"]));
+                    sqlPara.Add(new CDAParameter("HIGHPRESSUREFLAG", context.Request["HIGHPRESSUREFLAG"]));
                     sqlPara.Add(new CDAParameter("goodstypecode", context.Request["goodstypecode"].ToString()));
                     //直接获取不分页数据
                     JsonResult jsonresult = Easyui.ExecuteJsonResult(conn, sqlStr, sqlPara);
@@ -143,7 +143,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                 //子表
                 if (context.Request["n"].ToString() == "1")
                 {
-                    string sqlStr = "select g.goodscode 产品编码\n" +
+                    string sqlStr = "WITH ppp_details AS (  " +
+                        "select  TO_CHAR(g.goodscode) 产品编码\n" +
                    "          ,ppp.b_out_num 本烧出窑数\n" +
                    "          ,(ppp.b_out_num - ppp.b_bad_num) 本烧合格数\n" +
                    "          ,(ppp.c_out_num - ppp.c_bad_num) 重烧合格数\n" +
@@ -171,6 +172,7 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                    "         and p.createtime <  @dateend@\n" +
                    "		AND (@BUILDINGNO@ IS NULL OR instr(gl.BUILDINGNO , @BUILDINGNO@) > 0) " +
                    "		AND (@HIGHPRESSUREFLAG@ IS NULL OR instr(gl.HIGHPRESSUREFLAG , @HIGHPRESSUREFLAG@) > 0)" +
+                   "        AND (@groutinglineMaster@ IS NULL OR instr(gl.GROUTINGLINEID , @groutinglineMaster@) > 0)" +
                    "		AND (@goodstypecode@ IS NULL OR instr(gt.goodstypecode,@goodstypecode@) = 1)";
                     // 产品编码条件修正 fenglinyong modify 2022-05-10
                     if (!string.IsNullOrWhiteSpace(context.Request["goodscode"] + ""))
@@ -205,7 +207,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                                          and p.createtime >= @datebegin@
                                          and p.createtime <  @dateend@
 				                                AND (@BUILDINGNO@ IS NULL OR instr(gl.BUILDINGNO , @BUILDINGNO@) > 0)   
-				                                AND (@HIGHPRESSUREFLAG@ IS NULL OR instr(gl.HIGHPRESSUREFLAG , @HIGHPRESSUREFLAG@) > 0)		
+				                                AND (@HIGHPRESSUREFLAG@ IS NULL OR instr(gl.HIGHPRESSUREFLAG , @HIGHPRESSUREFLAG@) > 0)	
+                                                AND (@groutinglineMaster@ IS NULL OR instr(gl.GROUTINGLINEID , @groutinglineMaster@) > 0)
 				                                AND (@goodstypecode@ IS NULL OR instr(gt.goodstypecode,@goodstypecode@) = 1) ";
                     // 产品编码条件修正 fenglinyong modify 2022-05-10
                     if (!string.IsNullOrWhiteSpace(context.Request["goodscode"] + ""))
@@ -214,15 +217,26 @@ public class rpt : IHttpHandler, IReadOnlySessionState
                         sqlPara.Add(new CDAParameter("GOODSCODE", context.Request["goodscode"]));
                     }
 
-                    sqlStr +=  " )P GROUP BY 	p.goodsid ) pp group by pp.goodsid) ppp\n" +
+                    sqlStr += " )P GROUP BY 	p.goodsid ) pp group by pp.goodsid) ppp\n" +
                     "     inner join tp_mst_goods g\n" +
                     "        on g.goodsid = ppp.goodsid\n" +
-                    "     order by g.goodscode";
+                    "     order by g.goodscode) ";
+                        sqlStr += "SELECT * FROM ppp_details\n" +
+                    "UNION ALL\n" +
+                    "SELECT '合计' AS 产品编码," +
+                    "SUM(本烧出窑数) AS 本烧出窑数," +
+                    "SUM(本烧合格数) AS 本烧合格数," +
+                    "SUM(重烧合格数) AS 重烧合格数," +
+                    "ROUND((SUM(本烧合格数) + SUM(重烧合格数)) / NULLIF(SUM(本烧出窑数), 0), 4) * 100 || '%' AS 综合合格率\n " +
+                    "FROM ppp_details ";
                     sqlPara.Add(new CDAParameter("BUILDINGNO", context.Request["workshopcodeMaster"].ToString()));
-                    sqlPara.Add(new CDAParameter("HIGHPRESSUREFLAG",context.Request["HIGHPRESSUREFLAG"]));
+                    sqlPara.Add(new CDAParameter("HIGHPRESSUREFLAG", context.Request["HIGHPRESSUREFLAG"]));
+                    sqlPara.Add(new CDAParameter("groutinglineMaster", context.Request["groutinglineMaster"]));
                     sqlPara.Add(new CDAParameter("goodstypecode", context.Request["goodstypecode"].ToString()));
+
                     //直接获取不分页数据
                     JsonResult jsonresult = Easyui.ExecuteJsonResult(conn, sqlStr, sqlPara);
+
                     context.Response.Write(jsonresult.ToJson());
                 }
             }