chenxy пре 5 година
родитељ
комит
85cd6e35ab

Разлика између датотеке није приказан због своје велике величине
+ 1041 - 1005
DK.Client/ReportModule/R03/M01/F_RPT_030112.Designer.cs


+ 12 - 0
DK.Client/ReportModule/R03/M01/F_RPT_030112.resx

@@ -132,6 +132,9 @@
   <metadata name="g1mcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="g1mremark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="fhtime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
@@ -171,6 +174,9 @@
   <metadata name="g2mcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="g2mremark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="LogoName1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
@@ -207,6 +213,9 @@
   <metadata name="g3mcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="g3mremark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="colgoodscount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
@@ -219,6 +228,9 @@
   <metadata name="dataGridViewTextBoxColumn5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="g4mremark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="dataGridViewTextBoxColumn6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

+ 159 - 127
DK.Service/ReportModuleLogic/ReportModuleLogic.cs

@@ -3012,6 +3012,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
             "           AND ((:in_rptSprocedureId = 11 AND ((pd.procedureid = 11 AND pd.valueflag = '1') OR (pd.procedureid =104 AND pd.isrefire = '0' AND pd.checkflag = '1'))) \n" +
             "               OR (:in_rptSprocedureId = 58 AND ((pd.procedureid = 58 AND pd.valueflag = '1') OR (pd.procedureid =104 AND pd.isrefire = '6' AND pd.checkflag = '1'))) \n" +
             "               OR (:in_rptSprocedureId not in (11,58) AND pd.valueflag = '1' AND pd.procedureid = :in_rptSprocedureId))\n";
+            // end
 
             StringBuilder selSql = new StringBuilder(sqlString);
 			if (se.CreateTimeStart.HasValue)
@@ -4214,6 +4215,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
             "                   and (:in_rptSprocedureId is null or ((:in_rptSprocedureId = 11 AND ((pd.procedureid = 11 ) OR (pd.procedureid =104 AND pd.isrefire = '0'))) \n" +
             "               OR (:in_rptSprocedureId = 58 AND ((pd.procedureid = 58) OR (pd.procedureid =104 AND pd.isrefire = '6'))) \n" +
             "               OR (:in_rptSprocedureId not in (11,58) AND pd.procedureid = :in_rptSprocedureId)))\n" +
+            // end
             "                   and (:in_OutProcedureIDS is null or instr(','||:in_OutProcedureIDS||',', ','||pd.procedureid||',') > 0)\n" +
             "                   and pd.accountid = :in_AccountID\n";
 
@@ -4307,15 +4309,19 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 parameters.Add(new OracleParameter(":KilnID", OracleDbType.Int32, se.KilnID, ParameterDirection.Input));
             }
             sqlString =
-            "                   and exists\n" +
-            "                 (select 1\n" +
-            "                          from tp_pm_productiondata outpd\n" +
-            "                         where outpd.barcode = pd.barcode\n" +
-            //"                           and outpd.procedureid = :in_rptSprocedureId\n" +
-            "                   and (:in_rptSprocedureId is null or outpd.procedureid = :in_rptSprocedureId)\n" +
-            "                   and (:in_OutProcedureIDS is null or instr(','||:in_OutProcedureIDS||',', ','||outpd.procedureid||',') > 0)\n" +
-            "                           and outpd.valueflag = '1'\n" +
-            "                           and outpd.kilncarbatchno = pd.kilncarbatchno)) ppcc\n" +
+            //恒洁三车间特殊处理(质量相关)
+            //"                   and exists\n" +
+            //"                 (select 1\n" +
+            //"                          from tp_pm_productiondata outpd\n" +
+            //"                         where outpd.barcode = pd.barcode\n" +
+            ////"                           and outpd.procedureid = :in_rptSprocedureId\n" +
+            //"                   and (:in_rptSprocedureId is null or outpd.procedureid = :in_rptSprocedureId)\n" +
+            //"                   and (:in_OutProcedureIDS is null or instr(','||:in_OutProcedureIDS||',', ','||outpd.procedureid||',') > 0)\n" +
+            //"                           and outpd.valueflag = '1'\n" +
+            //"                           and outpd.kilncarbatchno = pd.kilncarbatchno)" +
+            "                   and ((:in_rptSprocedureId <> 58 and pd.isrefire = '0') or (:in_rptSprocedureId = 58 and pd.isrefire = '6'))\n" +
+            // end
+            ") ppcc\n" +
             "         inner join tp_pc_productionline pcpl\n" +
             "            on pcpl.productionlineid = ppcc.productionlineid\n" +
             "         inner join tp_mst_kiln mstkiln\n" +
@@ -6381,95 +6387,101 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 			parameters.Add(new OracleParameter(":AccountID", OracleDbType.Int32, user.AccountID, ParameterDirection.Input));
 			parameters.Add(new OracleParameter(":rptSprocedureId", OracleDbType.Int32, se.RptSProcedureID, ParameterDirection.Input));
 
-			selSql = selSql +
-					"SELECT pdata.Procedureid Procedureid " +
-					  " ,decode(gid, 3, '合计', 1, '小计【'||pdata.Procedurename||'】', pdata.Procedurename) Procedurename " +
-					  " ,decode(gid, 0, to_char(pdata.Userid), '--') Userid " +
-					  " ,decode(gid, 0, pdata.Usercode, '--') Usercode " +
-					  " ,decode(gid, 0, to_char(pdata.KilnID), '--') Kilnid " +
-					  " ,decode(gid, 0, pdata.Kilncode, '--') Kilncode " +
-					  " ,decode(gid, 0, pdata.goodstypename, '--') goodstypename " +
-					  " ,decode(gid, 0, to_char(pdata.Goodsid), '--') Goodsid " +
-					  " ,decode(gid, 0, pdata.Goodscode, '--') Goodscode " +
-					  " ,OutKilnCount " +
-				  " FROM (SELECT grouping_id(pdata.Procedureid, " +
-										  "  pdata.Userid ) gid " +
-							 "  ,pdata.Procedureid " +
-							 "  ,pdata.Procedurename " +
-							 "  ,pdata.Userid " +
-							 "  ,pdata.Usercode " +
-							 "  ,pdata.Kilnid " +
-							 "  ,pdata.Kilncode " +
-							 "  ,pdata.goodstypename " +
-							 "  ,pdata.Goodsid " +
-							 "  ,pdata.Goodscode " +
-							"   ,COUNT(pdata.Barcode) AS OutKilnCount " +
-						 "  FROM (SELECT DISTINCT " +
-					//"  decode(grouping(TP_PM_ProductionData.Procedureid),1,'--',TP_PM_ProductionData.Procedureid) Procedureid, " +
-					//"  decode(grouping(TP_PM_ProductionData.Procedurename),1,'合计', TP_PM_ProductionData.Procedurename) Procedurename, " +
-					//"  decode(grouping(TP_PM_ProductionData.Userid),1,'--', TP_PM_ProductionData.Userid) Userid, " +
-					//"  decode(grouping(TP_PM_ProductionData.Usercode),1,'--', TP_PM_ProductionData.Usercode) Usercode, " +
-					//"  decode(grouping(temp.Kilncode),1,'--', temp.KilnID) Kilnid, " +
-					//"  decode(grouping(temp.Kilncode),1,'--', temp.Kilncode) Kilncode, " +
-					//"  decode(grouping(tp_mst_goodstype.goodstypename),1,'--', tp_mst_goodstype.goodstypename) goodstypename, " +
-					//"  decode(grouping(TP_PM_ProductionData.Goodsid),1,'--', TP_PM_ProductionData.Goodsid) Goodsid, " +
-					//"  decode(grouping(TP_PM_ProductionData.Goodscode),1,'--', TP_PM_ProductionData.Goodscode) Goodscode, " +
-					"TP_PM_ProductionData.Procedureid,pcp.Procedurename, " +
-					//"TP_PM_ProductionData.Userid,TP_PM_ProductionData.Usercode, " +
-					(se.DisPUserCode ? "              TP_PM_ProductionData.userid, TP_PM_ProductionData.usercode, \n" : "              null userid, null usercode, \n") +
-					"temp.Kilnid,temp.Kilncode,tp_mst_goodstype.goodstypename, " +
-					"TP_PM_ProductionData.Goodsid,TP_PM_ProductionData.Goodscode, TP_PM_ProductionData.barcode " +
-					"  from TP_PM_ProductionData " +
-					"  inner join tp_mst_goods on tp_mst_goods.goodsid=TP_PM_ProductionData.Goodsid " +
-					"  inner join tp_mst_goodstype on tp_mst_goodstype.goodstypeid=tp_mst_goods.goodstypeid " +
-					"  inner join TP_MST_RptTProcedure on TP_MST_RptTProcedure.Procedureid=TP_PM_ProductionData.Procedureid " +
-					"  inner join TP_MST_RptProcedure on TP_MST_RptProcedure.Rptprocedureid=TP_MST_RptTProcedure.Rptprocedureid " +
-					"  inner join tp_pc_procedure pcp on pcp.procedureid=TP_PM_ProductionData.Procedureid " +
-					"  inner join " +
-					"  ( " +
-					"    SELECT TP_PM_ProductionData.CreateTime, TP_PM_ProductionData.ProductionDataID, TP_PM_ProductionData.Barcode, TP_PM_ProductionData.Kilncode,TP_PM_ProductionData.KilnID, TP_PM_ProductionData.KilnCarID " +
-					"    from TP_PM_ProductionData " +
-					"    inner join TP_MST_RptSProcedure on TP_MST_RptSProcedure.Procedureid=TP_PM_ProductionData.Procedureid ";
+            selSql = selSql +
+                    "SELECT pdata.Procedureid Procedureid " +
+                      " ,decode(gid, 3, '合计', 1, '小计【'||pdata.Procedurename||'】', pdata.Procedurename) Procedurename " +
+                      " ,decode(gid, 0, to_char(pdata.Userid), '--') Userid " +
+                      " ,decode(gid, 0, pdata.Usercode, '--') Usercode " +
+                      " ,decode(gid, 0, to_char(pdata.KilnID), '--') Kilnid " +
+                      " ,decode(gid, 0, pdata.Kilncode, '--') Kilncode " +
+                      " ,decode(gid, 0, pdata.goodstypename, '--') goodstypename " +
+                      " ,decode(gid, 0, to_char(pdata.Goodsid), '--') Goodsid " +
+                      " ,decode(gid, 0, pdata.Goodscode, '--') Goodscode " +
+                      " ,OutKilnCount " +
+                  " FROM (SELECT grouping_id(pdata.Procedureid, " +
+                                          "  pdata.Userid ) gid " +
+                             "  ,pdata.Procedureid " +
+                             "  ,pdata.Procedurename " +
+                             "  ,pdata.Userid " +
+                             "  ,pdata.Usercode " +
+                             "  ,pdata.Kilnid " +
+                             "  ,pdata.Kilncode " +
+                             "  ,pdata.goodstypename " +
+                             "  ,pdata.Goodsid " +
+                             "  ,pdata.Goodscode " +
+                            "   ,COUNT(pdata.Barcode) AS OutKilnCount " +
+                         "  FROM (SELECT DISTINCT " +
+                    //"  decode(grouping(TP_PM_ProductionData.Procedureid),1,'--',TP_PM_ProductionData.Procedureid) Procedureid, " +
+                    //"  decode(grouping(TP_PM_ProductionData.Procedurename),1,'合计', TP_PM_ProductionData.Procedurename) Procedurename, " +
+                    //"  decode(grouping(TP_PM_ProductionData.Userid),1,'--', TP_PM_ProductionData.Userid) Userid, " +
+                    //"  decode(grouping(TP_PM_ProductionData.Usercode),1,'--', TP_PM_ProductionData.Usercode) Usercode, " +
+                    //"  decode(grouping(temp.Kilncode),1,'--', temp.KilnID) Kilnid, " +
+                    //"  decode(grouping(temp.Kilncode),1,'--', temp.Kilncode) Kilncode, " +
+                    //"  decode(grouping(tp_mst_goodstype.goodstypename),1,'--', tp_mst_goodstype.goodstypename) goodstypename, " +
+                    //"  decode(grouping(TP_PM_ProductionData.Goodsid),1,'--', TP_PM_ProductionData.Goodsid) Goodsid, " +
+                    //"  decode(grouping(TP_PM_ProductionData.Goodscode),1,'--', TP_PM_ProductionData.Goodscode) Goodscode, " +
+                    "TP_PM_ProductionData.Procedureid,pcp.Procedurename, " +
+                    //"TP_PM_ProductionData.Userid,TP_PM_ProductionData.Usercode, " +
+                    (se.DisPUserCode ? "              TP_PM_ProductionData.userid, TP_PM_ProductionData.usercode, \n" : "              null userid, null usercode, \n") +
+                    "temp.Kilnid,temp.Kilncode,tp_mst_goodstype.goodstypename, " +
+                    "TP_PM_ProductionData.Goodsid,TP_PM_ProductionData.Goodscode, TP_PM_ProductionData.barcode " +
+                    "  from TP_PM_ProductionData " +
+                    "  inner join tp_mst_goods on tp_mst_goods.goodsid=TP_PM_ProductionData.Goodsid " +
+                    "  inner join tp_mst_goodstype on tp_mst_goodstype.goodstypeid=tp_mst_goods.goodstypeid " +
+                    "  inner join TP_MST_RptTProcedure on TP_MST_RptTProcedure.Procedureid=TP_PM_ProductionData.Procedureid " +
+                    //"  inner join TP_MST_RptProcedure on TP_MST_RptProcedure.Rptprocedureid=TP_MST_RptTProcedure.Rptprocedureid " +
+                    "  inner join tp_pc_procedure pcp on pcp.procedureid=TP_PM_ProductionData.Procedureid " +
+                    "  inner join " +
+                    "  ( " +
+                    "    SELECT pd.CreateTime, pd.ProductionDataID, pd.Barcode, pd.Kilncode,pd.KilnID, pd.KilnCarID " +
+                    "    from TP_PM_ProductionData pd ";
+                    //"    inner join TP_MST_RptSProcedure on TP_MST_RptSProcedure.Procedureid=pd.Procedureid ";
 			if (se.DTimeStart.HasValue || se.DTimeEnd.HasValue)
 			{
-				selSql += "  inner join tp_pm_groutingdailydetail gdd on gdd.groutingdailydetailid=TP_PM_ProductionData.groutingdailydetailid ";
+				selSql += "  inner join tp_pm_groutingdailydetail gdd on gdd.groutingdailydetailid=pd.groutingdailydetailid ";
 			}
-			selSql +=
-					"    where TP_PM_ProductionData.Accountid=:AccountID " +
-					"    and TP_PM_ProductionData.Valueflag='1' " +
-					// 数据重复 modify by chenxy begin
-					//  "    and TP_MST_RptSProcedure.Rptprocedureid=:rptProcedureId " +
-					// 数据重复 modify by chenxy end
-					"    and TP_MST_RptSProcedure.Procedureid=:rptSprocedureId ";
-			//if (se.CreateTimeStart.HasValue)
-			//{
-			//    selSql = selSql + " AND TP_PM_ProductionData.CreateTime >= :CreateTimeStart ";
-			//    parameters.Add(new OracleParameter(":CreateTimeStart", OracleDbType.Date, se.CreateTimeStart.Value, ParameterDirection.Input));
-			//}
-			//if (se.CreateTimeEnd.HasValue)
-			//{
-			//    selSql = selSql + " AND TP_PM_ProductionData.CreateTime <= :CreateTimeEnd ";
-			//    parameters.Add(new OracleParameter(":CreateTimeEnd", OracleDbType.Date, se.CreateTimeEnd.Value, ParameterDirection.Input));
-			//}
+            selSql +=
+                    "    where pd.Accountid=:AccountID " +
+            // 恒洁三车间特殊处理(质量相关)
+            //               "    and TP_PM_ProductionData.Valueflag='1' " +
+            //// 数据重复 modify by chenxy begin
+            ////  "    and TP_MST_RptSProcedure.Rptprocedureid=:rptProcedureId " +
+            //// 数据重复 modify by chenxy end
+            //"    and TP_MST_RptSProcedure.Procedureid=:rptSprocedureId ";
+            "           AND ((:rptSprocedureId = 11 AND ((pd.procedureid = 11 AND pd.valueflag = '1') OR (pd.procedureid =104 AND pd.isrefire = '0' AND pd.checkflag = '1'))) \n" +
+            "               OR (:rptSprocedureId = 58 AND ((pd.procedureid = 58 AND pd.valueflag = '1') OR (pd.procedureid =104 AND pd.isrefire = '6' AND pd.checkflag = '1'))) \n" +
+            "               OR (:rptSprocedureId not in (11,58) AND pd.valueflag = '1' AND pd.procedureid = :rptSprocedureId))\n";
+                // end
 
-			if (se.OutTimeStart.HasValue)
+                //if (se.CreateTimeStart.HasValue)
+                //{
+                //    selSql = selSql + " AND TP_PM_ProductionData.CreateTime >= :CreateTimeStart ";
+                //    parameters.Add(new OracleParameter(":CreateTimeStart", OracleDbType.Date, se.CreateTimeStart.Value, ParameterDirection.Input));
+                //}
+                //if (se.CreateTimeEnd.HasValue)
+                //{
+                //    selSql = selSql + " AND TP_PM_ProductionData.CreateTime <= :CreateTimeEnd ";
+                //    parameters.Add(new OracleParameter(":CreateTimeEnd", OracleDbType.Date, se.CreateTimeEnd.Value, ParameterDirection.Input));
+                //}
+
+            if (se.OutTimeStart.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.CreateTime >=:OutTimeStart ";
+				selSql = selSql + " AND pd.CreateTime >=:OutTimeStart ";
 				parameters.Add(new OracleParameter(":OutTimeStart", OracleDbType.Date, se.OutTimeStart.Value, ParameterDirection.Input));
 			}
 			if (se.OutTimeEnd.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.CreateTime <= :OutTimeEnd ";
+				selSql = selSql + " AND pd.CreateTime <= :OutTimeEnd ";
 				parameters.Add(new OracleParameter(":OutTimeEnd", OracleDbType.Date, se.OutTimeEnd.Value, ParameterDirection.Input));
 			}
 			if (se.GTimeStart.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.GROUTINGDATE >=:GTimeStart ";
+				selSql = selSql + " AND pd.GROUTINGDATE >=:GTimeStart ";
 				parameters.Add(new OracleParameter(":GTimeStart", OracleDbType.Date, se.GTimeStart.Value, ParameterDirection.Input));
 			}
 			if (se.GTimeEnd.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.GROUTINGDATE <= :GTimeEnd ";
+				selSql = selSql + " AND pd.GROUTINGDATE <= :GTimeEnd ";
 				parameters.Add(new OracleParameter(":GTimeEnd", OracleDbType.Date, se.GTimeEnd.Value, ParameterDirection.Input));
 			}
 			if (se.DTimeStart.HasValue)
@@ -6503,9 +6515,11 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 
 						"     ((TP_PM_ProductionData.modeltype <> 5) or (TP_PM_ProductionData.modeltype = 5  and TP_PM_ProductionData.SpecialRepairFlag = '0')) \n" +
 
-						"    and TP_PM_ProductionData.Valueflag='1' " +
-						" and TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId ";
-				parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
+                        "    and TP_PM_ProductionData.Valueflag='1' " +
+                        //" and TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId ";
+                        " and TP_MST_RptTProcedure.Rptprocedureid=:rptProcedureId ";
+
+                parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
 			}
 			else
 			{
@@ -6519,10 +6533,11 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 																				" WHERE pp.barcode = temp.barcode and pp.createtime > TP_PM_ProductionData.createtime\n" +
 																				"   AND pp.createtime < temp.createtime\n" +
 																				"   AND pp.procedureid = TP_PM_ProductionData.Procedureid)))\n" +
-						// 重烧交接等工序重复统计的问题 by chenxy 2016-10-08 end
-						"  where TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId " +
-						"    and TP_PM_ProductionData.Valueflag='1' ";
-				parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
+                        // 重烧交接等工序重复统计的问题 by chenxy 2016-10-08 end
+                        "  where TP_PM_ProductionData.Valueflag='1' " +
+                        //" and TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId ";
+                        " and TP_MST_RptTProcedure.Rptprocedureid=:rptProcedureId ";
+                parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
 			}
 
 			if (se.CreateTimeStart.HasValue)
@@ -6664,7 +6679,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 					"inner join tp_mst_goods on tp_mst_goods.goodsid=TP_PM_ProductionData.Goodsid " +
 					"inner join tp_mst_goodstype on tp_mst_goodstype.goodstypeid=tp_mst_goods.goodstypeid " +
 					"inner join TP_MST_RptTProcedure on TP_MST_RptTProcedure.Procedureid=TP_PM_ProductionData.Procedureid " +
-					"inner join TP_MST_RptProcedure on TP_MST_RptProcedure.Rptprocedureid=TP_MST_RptTProcedure.Rptprocedureid " +
+					//"inner join TP_MST_RptProcedure on TP_MST_RptProcedure.Rptprocedureid=TP_MST_RptTProcedure.Rptprocedureid " +
 					"  inner join tp_pc_procedure pcp on pcp.procedureid=TP_PM_ProductionData.Procedureid " +
 
 					"left join TP_MST_logo on TP_PM_ProductionData.logoid=TP_MST_logo.logoid " +
@@ -6673,46 +6688,51 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 					"inner join " +
 					"( " +
 					"  select " +
-					"  TP_PM_ProductionData.Barcode, " +
-					"  TP_PM_ProductionData.Kilncode, " +
-					"  TP_PM_ProductionData.Kilncarcode, " +
-					"  TP_PM_ProductionData.Createtime, " +
-					"  TP_PM_ProductionData.KilnID " +
+                    "  pd.Barcode, " +
+                    "  pd.Kilncode, " +
+                    "  pd.Kilncarcode, " +
+                    "  pd.Createtime, " +
+                    "  pd.KilnID " +
 					"  ,gdd.DELIVERTIME " +
-					"  ,TP_PM_ProductionData.GROUTINGDATE " +
-					"  ,TP_PM_ProductionData.KilnCarID " +
-					"  from TP_PM_ProductionData " +
-					"  inner join TP_MST_RptSProcedure on TP_MST_RptSProcedure.Procedureid=TP_PM_ProductionData.Procedureid " +
-			//if (se.DTimeStart.HasValue || se.DTimeEnd.HasValue)
-			//{
-			//    selSql += "  inner join tp_pm_groutingdailydetail gdd on gdd.groutingdailydetailid=TP_PM_ProductionData.groutingdailydetailid ";
-			//}
-			"  inner join tp_pm_groutingdailydetail gdd on gdd.groutingdailydetailid=TP_PM_ProductionData.groutingdailydetailid " +
-					//        selSql +=
-					"  where TP_PM_ProductionData.Accountid=:AccountID " +
-					"  and TP_PM_ProductionData.Valueflag='1' " +
-					// 数据重复 modify by chenxy begin
-					"    and TP_MST_RptSProcedure.Rptprocedureid=:rptProcedureId " +
-					// 数据重复 modify by chenxy end
-					"  and TP_MST_RptSProcedure.Procedureid=:rptSprocedureId ";
-			if (se.OutTimeStart.HasValue)
-			{
-				selSql = selSql + " AND TP_PM_ProductionData.CreateTime >=:OutTimeStart ";
+                    "  ,pd.GROUTINGDATE " +
+                    "  ,pd.KilnCarID " +
+					"  from TP_PM_ProductionData pd" +
+            //"  inner join TP_MST_RptSProcedure on TP_MST_RptSProcedure.Procedureid=TP_PM_ProductionData.Procedureid " +
+            //if (se.DTimeStart.HasValue || se.DTimeEnd.HasValue)
+            //{
+            //    selSql += "  inner join tp_pm_groutingdailydetail gdd on gdd.groutingdailydetailid=TP_PM_ProductionData.groutingdailydetailid ";
+            //}
+            "  inner join tp_pm_groutingdailydetail gdd on gdd.groutingdailydetailid=pd.groutingdailydetailid " +
+                    //        selSql +=
+                    "  where pd.Accountid=:AccountID " +
+            // 恒洁三车间特殊处理(质量相关)
+            //               "  and pd.Valueflag='1' " +
+            //// 数据重复 modify by chenxy begin
+            //"    and TP_MST_RptSProcedure.Rptprocedureid=:rptProcedureId " +
+            //// 数据重复 modify by chenxy end
+            //"  and TP_MST_RptSProcedure.Procedureid=:rptSprocedureId ";
+            "           AND ((:rptSprocedureId = 11 AND ((pd.procedureid = 11 AND pd.valueflag = '1') OR (pd.procedureid =104 AND pd.isrefire = '0' AND pd.checkflag = '1'))) \n" +
+            "               OR (:rptSprocedureId = 58 AND ((pd.procedureid = 58 AND pd.valueflag = '1') OR (pd.procedureid =104 AND pd.isrefire = '6' AND pd.checkflag = '1'))) \n" +
+            "               OR (:rptSprocedureId not in (11,58) AND pd.valueflag = '1' AND pd.procedureid = :rptSprocedureId))\n";
+
+            if (se.OutTimeStart.HasValue)
+			{
+				selSql = selSql + " AND pd.CreateTime >=:OutTimeStart ";
 				parameters.Add(new OracleParameter(":OutTimeStart", OracleDbType.Date, se.OutTimeStart.Value, ParameterDirection.Input));
 			}
 			if (se.OutTimeEnd.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.CreateTime <= :OutTimeEnd ";
+				selSql = selSql + " AND pd.CreateTime <= :OutTimeEnd ";
 				parameters.Add(new OracleParameter(":OutTimeEnd", OracleDbType.Date, se.OutTimeEnd.Value, ParameterDirection.Input));
 			}
 			if (se.GTimeStart.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.GROUTINGDATE >=:GTimeStart ";
+				selSql = selSql + " AND pd.GROUTINGDATE >=:GTimeStart ";
 				parameters.Add(new OracleParameter(":GTimeStart", OracleDbType.Date, se.GTimeStart.Value, ParameterDirection.Input));
 			}
 			if (se.GTimeEnd.HasValue)
 			{
-				selSql = selSql + " AND TP_PM_ProductionData.GROUTINGDATE <= :GTimeEnd ";
+				selSql = selSql + " AND pd.GROUTINGDATE <= :GTimeEnd ";
 				parameters.Add(new OracleParameter(":GTimeEnd", OracleDbType.Date, se.GTimeEnd.Value, ParameterDirection.Input));
 			}
 			if (se.DTimeStart.HasValue)
@@ -6743,9 +6763,10 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 								   //"    and ((TP_PM_ProductionData.modeltype <> 5) or (TP_PM_ProductionData.modeltype = 5 and TP_PM_ProductionData.IsPublicBody = '0' and TP_PM_ProductionData.SpecialRepairFlag = '0')) \n" +
 								   // modify wangx 2015-12-3
 						"     ((TP_PM_ProductionData.modeltype <> 5) or (TP_PM_ProductionData.modeltype = 5 and TP_PM_ProductionData.SpecialRepairFlag = '0')) \n" +
-						"    and TP_PM_ProductionData.Valueflag='1' " +
-						" and TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId ";
-				parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
+					    "    and TP_PM_ProductionData.Valueflag='1' " +
+						//" and TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId ";
+                        " and TP_MST_RptTProcedure.Rptprocedureid=:rptProcedureId ";
+                parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
 			}
 			else
 			{
@@ -6760,9 +6781,12 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 																				"   AND pp.createtime < temp.createtime\n" +
 																				"   AND pp.procedureid = TP_PM_ProductionData.Procedureid)))\n" +
 					   // 重烧交接等工序重复统计的问题 by chenxy 2016-10-08 end
-					   " where TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId " +
-					   "    and TP_PM_ProductionData.Valueflag='1' ";
-				parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
+					   //" where TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId " +
+					   //"    and TP_PM_ProductionData.Valueflag='1' ";
+                    "  where TP_PM_ProductionData.Valueflag='1' " +
+                    //" and TP_MST_RptProcedure.Rptprocedureid=:rptProcedureId ";
+                    " and TP_MST_RptTProcedure.Rptprocedureid=:rptProcedureId ";
+                parameters.Add(new OracleParameter(":rptProcedureId", OracleDbType.Int32, se.RptProcedureID, ParameterDirection.Input));
 			}
 
 			if (se.CreateTimeStart.HasValue)
@@ -9539,7 +9563,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 "           AND ((:HandOverProcedureID = 1 AND ((hopd.procedureid = 11 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '0' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID = 5 AND ((hopd.procedureid = 58 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '6' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID not in (1,5) AND hopd.valueflag = '1' AND hopd.procedureid = (select procedureid from tp_mst_rptsprocedure t where t.rptprocedureid = :HandOverProcedureID)))\n" +
-
+                // end
 				"         WHERE pmd.valueflag = '1'\n" +
 				"           AND pd.ModelType = -1\n" +
 				"           AND pmd.AccountID = :AccountID\n";
@@ -9851,6 +9875,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 "           AND ((:HandOverProcedureID = 1 AND ((hopd.procedureid = 11 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '0' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID = 5 AND ((hopd.procedureid = 58 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '6' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID not in (1,5) AND hopd.valueflag = '1' AND hopd.procedureid = (select procedureid from tp_mst_rptsprocedure t where t.rptprocedureid = :HandOverProcedureID)))\n" +
+                // end
                 "  LEFT JOIN TP_MST_DefectFine mstdf\n" +
 				"    ON pmd.DefectFine = mstdf.DefectFineID\n" +
 				"  LEFT JOIN tp_mst_logo logo\n" +
@@ -10178,6 +10203,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 "           AND ((:HandOverProcedureID = 1 AND ((hopd.procedureid = 11 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '0' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID = 5 AND ((hopd.procedureid = 58 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '6' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID not in (1,5) AND hopd.valueflag = '1' AND hopd.procedureid = (select procedureid from tp_mst_rptsprocedure t where t.rptprocedureid = :HandOverProcedureID)))\n" +
+                // end
                 "  LEFT JOIN TP_MST_DefectFine mstdf\n" +
 				"    ON pmd.DefectFine = mstdf.DefectFineID\n" +
 				"  LEFT JOIN tp_mst_logo logo\n" +
@@ -10506,6 +10532,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 "           AND ((:HandOverProcedureID = 1 AND ((hopd.procedureid = 11 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '0' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID = 5 AND ((hopd.procedureid = 58 AND hopd.valueflag = '1') OR (hopd.procedureid =104 AND hopd.isrefire = '6' AND hopd.checkflag = '1'))) \n" +
                 "               OR (:HandOverProcedureID not in (1,5) AND hopd.valueflag = '1' AND hopd.procedureid = (select procedureid from tp_mst_rptsprocedure t where t.rptprocedureid = :HandOverProcedureID)))\n" +
+                //end
                 "  LEFT JOIN TP_MST_DefectFine mstdf\n" +
 				"    ON pmd.DefectFine = mstdf.DefectFineID\n" +
 				"  LEFT JOIN tp_mst_logo logo\n" +
@@ -12926,6 +12953,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 "      ,nvl(g.goodscode, '--') goodscode" +
                 "      ,nvl(g.goodsmodel, '--') goodsmodel" +
                 "      ,nvl(gdd.materialcode, '--') mcode" +
+                "      ,nvl(gdd.materialremark, '--') mremark" +
                 "      ,f.logoid" +
                 "      ,f.goodsid" +
                 "      ,f.fhorderid" +
@@ -12993,7 +13021,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                     parameters.Add(new OracleParameter(":FHUserCode", OracleDbType.NVarchar2, cre.Properties["FHUserCode"], ParameterDirection.Input));
                 }
                 //sqlString += " group by trunc(f.fhtime), g.goodscode order by trunc(f.fhtime), g.goodscode";
-                sqlString += "  group by grouping sets((o.orderno, l.logoname, g.goodscode, g.goodsmodel, gdd.materialcode,f.logoid,f.goodsid,f.fhorderid),(o.orderno, l.logoname,f.logoid,f.fhorderid),(o.orderno,f.fhorderid),())";
+                sqlString += "  group by grouping sets((o.orderno, l.logoname, g.goodscode, g.goodsmodel, gdd.materialcode,gdd.materialremark,f.logoid,f.goodsid,f.fhorderid),(o.orderno, l.logoname,f.logoid,f.fhorderid),(o.orderno,f.fhorderid),())";
 
                 DataTable data = conn.GetSqlResultToDt(sqlString, parameters.ToArray());
 
@@ -13082,6 +13110,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 //"       nvl(g.outlabelcode, GOODS.MATERIALCODE || (select a.workcode from tp_mst_account a where a.accountid = g.accountid) || L.TAGCODE || G.ONLYCODE) AS FINISHEDBARCODE,\n" +
 "       G.outlabelcode AS FINISHEDBARCODE,\n" +
 "       G.MATERIALCODE AS mcode,\n" +
+"       G.materialremark AS mremark,\n" +
 "       F.CREATETIME AS PRODUCTFINISHEDTIME\n" +
 								"  FROM TP_PM_FINISHEDPRODUCT F\n" +
 								"  LEFT JOIN TP_PM_ORDER O\n" +
@@ -13196,6 +13225,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 				"      ,nvl(g.goodscode, '--') goodscode" +
                 "      ,nvl(g.goodsmodel, '--') goodsmodel" +
                 "      ,nvl(gdd.materialcode, '--') mcode" +
+                "      ,nvl(gdd.materialremark, '--') mremark" +
                 "      ,COUNT(*) goodscount" +
 				"  FROM tp_pm_finishedproduct f\n" +
                 "  inner JOIN tp_pm_groutingdailydetail gdd\n" +
@@ -13260,7 +13290,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 					parameters.Add(new OracleParameter(":FHUserCode", OracleDbType.NVarchar2, cre.Properties["FHUserCode"], ParameterDirection.Input));
 				}
 				//sqlString += " group by trunc(f.fhtime), g.goodscode order by trunc(f.fhtime), g.goodscode";
-				sqlString += "  GROUP BY GROUPING SETS((trunc(f.fhtime), l.logoname, g.goodscode,g.goodsmodel,gdd.materialcode),(trunc(f.fhtime), l.logoname),(trunc(f.fhtime)),())";
+				sqlString += "  GROUP BY GROUPING SETS((trunc(f.fhtime), l.logoname, g.goodscode,g.goodsmodel,gdd.materialcode,gdd.materialremark),(trunc(f.fhtime), l.logoname),(trunc(f.fhtime)),())";
 
 				DataTable data = conn.GetSqlResultToDt(sqlString, parameters.ToArray());
 
@@ -13319,7 +13349,8 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 				"       nvl(g.goodscode, '合计') goodscode" +
 				"      ,nvl(g.goodsmodel, '--') goodsmodel" +
 				"      ,nvl(gdd.materialcode, '--') mcode" +
-				"      ,COUNT(*) goodscount" +
+                "      ,nvl(gdd.materialremark, '--') mremark" +
+                "      ,COUNT(*) goodscount" +
 				"  FROM tp_pm_finishedproduct f\n" +
 				"  inner JOIN tp_pm_groutingdailydetail gdd\n" +
 				"    ON gdd.barcode = f.barcode\n" +
@@ -13383,7 +13414,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
 					parameters.Add(new OracleParameter(":FHUserCode", OracleDbType.NVarchar2, cre.Properties["FHUserCode"], ParameterDirection.Input));
 				}
 				//sqlString += " group by trunc(f.fhtime), g.goodscode order by trunc(f.fhtime), g.goodscode";
-				sqlString += "  GROUP BY GROUPING SETS((g.goodscode,g.goodsmodel,gdd.materialcode),())";
+				sqlString += "  GROUP BY GROUPING SETS((g.goodscode,g.goodsmodel,gdd.materialcode,gdd.materialremark),())";
 
 				DataTable data = conn.GetSqlResultToDt(sqlString, parameters.ToArray());
 
@@ -15905,6 +15936,7 @@ namespace Dongke.IBOSS.PRD.Service.ReportModuleLogic
                 "              ,nvl(sum(case when p.procedureid in (12,105) and p.isrefire='0' then 1 else 0 end), 0) b_bad_num -- 本烧不合格数\n" +
                 "              ,nvl(sum(case when p.procedureid in (58,104) and p.isrefire='6' then 1 else 0 end), 0) c_out_num -- 重烧出窑数\n" +
                 "              ,nvl(sum(case when p.procedureid in (59,105) and p.isrefire='6' then 1 else 0 end), 0) c_bad_num -- 重烧不合格数\n" +
+                // end
                 "          from tp_pm_productiondata p\n" +
                 "         where p.valueflag = '1'\n" +
                 "           and p.accountid = :accountid\n" +

Неке датотеке нису приказане због велике количине промена