diff --git a/DataBase/版本日志/HJGLDB_DS_2025-05-12_gf.sql b/DataBase/版本日志/HJGLDB_DS_2025-05-12_gf.sql new file mode 100644 index 0000000..bab0357 --- /dev/null +++ b/DataBase/版本日志/HJGLDB_DS_2025-05-12_gf.sql @@ -0,0 +1,140 @@ +CREATE PROC [dbo].[HJGL_sp_rpt_welderPerformanceSum] + @unitcode VARCHAR(50) = NULL, + @steel VARCHAR(50) = NULL, + @WED_ID NVARCHAR(50) = NULL, + @date1 DATETIME = NULL, + @date2 DATETIME = NULL, + @projectId NVARCHAR(500) = NULL, + @installationId NVARCHAR(50)=NULL +AS +/*ҵ*/ +SELECT + NEWID() AS Id, + -------------start + CAST(ISNULL(total.totalSize,0) AS DECIMAL(19,2)) AS totalSize, --ܴ羶 + ISNULL(total.totalJoint,0) AS totalJoint, --ܺ + ISNULL(JointNum1.JointNum1,0) AS JointNum1, --һƬ + + ISNULL(JointNum1.JointNum1,0)-ISNULL(JointNoPassNum1.JointNoPassNum1,0) AS JointPassNum1, --һƬϸ񺸿 + ISNULL(JointNoPassNum1.JointNoPassNum1,0) AS RepairJoint1, --һη޺ + ISNULL(RepairJoint2.RepairJoint2,0) AS RepairJoint2, --η޺ + ISNULL(RepairJoint3.RepairJoint3,0) AS RepairJoint3, --η޺ + + CAST((CASE ISNULL((ISNULL(JointNum1.JointNum1,0)-ISNULL(JointNoPassNum1.JointNoPassNum1,0)),0) WHEN 0 THEN 0 + ELSE (CASE(ISNULL(JointNum1.JointNum1,0)) WHEN 0 THEN 0 + ELSE 1.0 * ISNULL((ISNULL(JointNum1.JointNum1,0)-ISNULL(JointNoPassNum1.JointNoPassNum1,0)),0)/(1.0 * JointNum1.JointNum1) + END)END) AS DECIMAL(19,3)) AS JointPassRate , ---һƬںϸ + + ISNULL(JointNum1.totalfilm,0) AS totalfilm, --һƬ + (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0)) AS totalPassfilm, --һƬϸ + ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0) AS repairFilm1, --һηƬ + + ISNULL(RepairJoint2.repairFilm2,0) AS repairFilm2, --ηƬ + ISNULL(RepairJoint3.repairFilm3,0) AS repairFilm3, --ηƬ + + CAST((CASE (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0)) WHEN 0 THEN 0 + ELSE (CASE(ISNULL(JointNum1.totalfilm,0)) WHEN 0 THEN 0 + ELSE 1.0 * (ISNULL(JointNum1.totalfilm,0)- ISNULL(JointNoPassNum2.JointNoPassFilmNum2,0))/(1.0 * JointNum1.totalfilm) + END) END) AS DECIMAL(19,3)) AS JointFilmPassRate ---һƬϸ + +FROM + --ֵܴ --ܺ + (SELECT SUM(joint.JOT_Size) AS totalSize,COUNT(*) AS totalJoint + ,joint.ProjectId,joint.InstallationId,iso.BSU_ID + FROM HJGL_PW_JointInfo joint + LEFT JOIN HJGL_PW_IsoInfo iso ON iso.ISO_ID = joint.ISO_ID + LEFT JOIN HJGL_BO_WeldReportMain report ON joint.DReportID = report.DReportID + WHERE joint.DReportID IS NOT NULL + AND (report.JOT_WeldDate >= @date1 OR @date1 IS NULL) AND (report.JOT_WeldDate <= @date2 OR @date2 IS NULL) + AND (joint.ste_id=@steel OR @steel IS NULL) + GROUP BY joint.ProjectId,joint.InstallationId,iso.BSU_ID) AS total + + +--һƬ , һƬ,һƬϸ + LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS JointNum1, SUM(joint.RT_FilmNum) AS totalfilm, + joint.ProjectId,joint.InstallationId,iso.BSU_ID + FROM HJGL_PW_JointInfo joint + LEFT JOIN HJGL_PW_IsoInfo iso ON iso.ISO_ID = joint.ISO_ID + WHERE joint.PointType='' AND joint.RT_FilmNum IS NOT NULL and joint.RT_FilmNum>0 and (select COUNT(*) from dbo.HJGL_BO_QualityRating where JOT_ID=joint.JOT_ID and FilmNum is not null)>0 + AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_BO_QualityRating WHERE JOT_ID=joint.JOT_ID)>= @date1 OR @date1 IS NULL) + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_BO_QualityRating WHERE JOT_ID=joint.JOT_ID)<= @date2 OR @date2 IS NULL) + GROUP BY joint.ProjectId,joint.InstallationId,iso.BSU_ID) AS JointNum1 + ON JointNum1.ProjectId=total.ProjectId AND JointNum1.InstallationId = total.InstallationId + AND JointNum1.BSU_ID = total.BSU_ID + + --һƬϸ񺸿 + LEFT JOIN (SELECT COUNT(distinct joint.JOT_ID) AS JointNoPassNum1, + joint.ProjectId,joint.InstallationId,iso.BSU_ID + FROM HJGL_PW_JointInfo joint + LEFT JOIN HJGL_PW_IsoInfo iso ON iso.ISO_ID = joint.ISO_ID + left join dbo.HJGL_CH_RepairItemRecord rr on rr.JOT_ID=joint.JOT_ID + WHERE joint.PointType='' AND (joint.RT1_RepairFilm IS NOT NULL or (select top 1 CH_TrustItemID from dbo.HJGL_CH_TrustItem ti where ti.JOT_ID=joint.JOT_ID and ti.States='4') is not null) + AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL and rr.RepairMark='R1' + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R1')>= @date1 OR @date1 IS NULL) + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R1')<= @date2 OR @date2 IS NULL) + GROUP BY joint.ProjectId,joint.InstallationId,iso.BSU_ID) AS JointNoPassNum1 + ON JointNoPassNum1.ProjectId=total.ProjectId AND JointNoPassNum1.InstallationId = total.InstallationId + AND JointNoPassNum1.BSU_ID = total.BSU_ID + --һƬϸƬ + LEFT JOIN (SELECT count(rr.RepairItemRecordId) as JointNoPassFilmNum2, + joint.ProjectId,joint.InstallationId,iso.BSU_ID + FROM dbo.HJGL_CH_RepairItemRecord rr + left join HJGL_PW_JointInfo joint on rr.JOT_ID=joint.JOT_ID + LEFT JOIN HJGL_PW_IsoInfo iso ON iso.ISO_ID = joint.ISO_ID + WHERE joint.PointType='' + --AND (joint.RT1_RepairFilm IS NOT NULL or (select top 1 CH_TrustItemID from dbo.HJGL_CH_TrustItem ti where ti.JOT_ID=joint.JOT_ID and ti.States='4') is not null) + AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL and rr.RepairMark='R1' + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R1')>= @date1 OR @date1 IS NULL) + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R1')<= @date2 OR @date2 IS NULL) + GROUP BY joint.ProjectId,joint.InstallationId,iso.BSU_ID) AS JointNoPassNum2 + ON JointNoPassNum2.ProjectId=total.ProjectId AND JointNoPassNum2.InstallationId = total.InstallationId + AND JointNoPassNum2.BSU_ID = total.BSU_ID + --ηƬ,ηƬ + LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS RepairJoint2, SUM(ISNULL(joint.RT2_RepairFilmNum,0)) AS RepairFilm2, + joint.ProjectId,joint.InstallationId,iso.BSU_ID + FROM HJGL_PW_JointInfo joint + LEFT JOIN HJGL_PW_IsoInfo iso ON iso.ISO_ID = joint.ISO_ID + WHERE joint.PointType='' AND joint.RT2_RepairFilm IS NOT NULL + AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R2')>= @date1 OR @date1 IS NULL) + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R2')<= @date2 OR @date2 IS NULL) + GROUP BY joint.ProjectId,joint.InstallationId,iso.BSU_ID) AS RepairJoint2 + ON RepairJoint2.ProjectId=total.ProjectId AND RepairJoint2.InstallationId = total.InstallationId + AND RepairJoint2.BSU_ID = total.BSU_ID + + + + --ηƬ,ηƬ + LEFT JOIN (SELECT COUNT(joint.JOT_ID) AS RepairJoint3, SUM(ISNULL(joint.RT3_RepairFilmNum,0)) AS RepairFilm3, + joint.ProjectId,joint.InstallationId,iso.BSU_ID + FROM HJGL_PW_JointInfo joint + LEFT JOIN HJGL_PW_IsoInfo iso ON iso.ISO_ID = joint.ISO_ID + WHERE joint.PointType='' AND joint.RT3_RepairFilm IS NOT NULL + AND (joint.ste_id=@steel OR @steel IS NULL) AND joint.dreportid IS NOT NULL + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R3')>= @date1 OR @date1 IS NULL) + AND ((SELECT TOP 1 SignDate FROM dbo.HJGL_CH_RepairItemRecord WHERE JOT_ID=joint.JOT_ID AND RepairMark='R3')<= @date2 OR @date2 IS NULL) + GROUP BY joint.ProjectId,joint.InstallationId,iso.BSU_ID) AS RepairJoint3 + ON RepairJoint3.ProjectId=total.ProjectId AND RepairJoint3.InstallationId = total.InstallationId + AND RepairJoint3.BSU_ID = total.BSU_ID + +LEFT JOIN Base_Project project ON total.ProjectId=project.ProjectId + +WHERE + (CHARINDEX(total.ProjectId,@projectId)>0 OR @projectId IS NULL) + AND (total.InstallationId = @installationId OR @installationId IS NULL) + AND (total.BSU_ID=@unitcode OR @unitcode IS NULL) + --AND (total.Welder = @WED_ID OR @WED_ID IS NULL) + + + + + + + + + + + + +GO diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx index c3fb624..5ceda75 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx @@ -45,6 +45,7 @@ + diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.cs b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.cs index 211561c..d022212 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.cs @@ -7,6 +7,7 @@ using System.Text; using BLL; using Newtonsoft.Json.Linq; + using System.Linq; using AspNet = System.Web.UI.WebControls; public partial class WelderPerformance : PageBase @@ -74,50 +75,119 @@ string filmPassRate = ""; string jointPassRate = ""; - foreach (DataRow row in tb.Rows) - { - totalSize += Convert.ToDouble(row["totalSize"]); - totalJoint += Convert.ToInt32(row["totalJoint"]); - JointNum1 += Convert.ToInt32(row["JointNum1"]); - totalfilm += Convert.ToInt32(row["totalfilm"]); - JointPassNum1 += Convert.ToInt32(row["JointPassNum1"]); - totalPassfilm += Convert.ToInt32(row["totalPassfilm"]); + //foreach (DataRow row in tb.Rows) + //{ + // totalSize += Convert.ToDouble(row["totalSize"]); + // totalJoint += Convert.ToInt32(row["totalJoint"]); + // JointNum1 += Convert.ToInt32(row["JointNum1"]); + // totalfilm += Convert.ToInt32(row["totalfilm"]); + // JointPassNum1 += Convert.ToInt32(row["JointPassNum1"]); + // totalPassfilm += Convert.ToInt32(row["totalPassfilm"]); - RepairJoint1 += Convert.ToInt32(row["RepairJoint1"]); - repairFilm1 += Convert.ToInt32(row["repairFilm1"]); - RepairJoint2 += Convert.ToInt32(row["RepairJoint2"]); - repairFilm2 += Convert.ToInt32(row["repairFilm2"]); - RepairJoint3 += Convert.ToInt32(row["RepairJoint3"]); - repairFilm3 += Convert.ToInt32(row["repairFilm3"]); - } - if (totalfilm != 0) + // RepairJoint1 += Convert.ToInt32(row["RepairJoint1"]); + // repairFilm1 += Convert.ToInt32(row["repairFilm1"]); + // RepairJoint2 += Convert.ToInt32(row["RepairJoint2"]); + // repairFilm2 += Convert.ToInt32(row["repairFilm2"]); + // RepairJoint3 += Convert.ToInt32(row["RepairJoint3"]); + // repairFilm3 += Convert.ToInt32(row["repairFilm3"]); + //} + //if (totalfilm != 0) + //{ + // filmPassRate = (totalPassfilm * 100.0 / totalfilm * 1.0).ToString("0.00") + "%"; + //} + //if (JointNum1 != 0) + //{ + // jointPassRate = (JointPassNum1 * 100.0 / JointNum1 * 1.0).ToString("0.00") + "%"; + //} + string projectIds = String.Join(",", drpProject.SelectedValueArray); + List listStr = new List(); + + if (this.drpIns.SelectedValue != BLL.Const._Null) { - filmPassRate = (totalPassfilm * 100.0 / totalfilm * 1.0).ToString("0.00") + "%"; + listStr.Add(new SqlParameter("@installationId", this.drpIns.SelectedValue)); } - if (JointNum1 != 0) + else { - jointPassRate = (JointPassNum1 * 100.0 / JointNum1 * 1.0).ToString("0.00") + "%"; + listStr.Add(new SqlParameter("@installationId", null)); } - JObject summary = new JObject(); - summary.Add("tfNumber", "合计"); - summary.Add("totalJoint", totalJoint.ToString()); - summary.Add("totalSize", totalSize.ToString("F2")); - summary.Add("JointNum1", JointNum1.ToString()); - summary.Add("totalfilm", totalfilm.ToString()); - summary.Add("JointPassNum1", JointPassNum1.ToString()); - summary.Add("totalPassfilm", totalPassfilm.ToString()); + if (this.drpUnit.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@unitcode", this.drpUnit.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@unitcode", null)); + } - summary.Add("RepairJoint1", RepairJoint1.ToString()); - summary.Add("repairFilm1", repairFilm1.ToString()); - summary.Add("RepairJoint2", RepairJoint2.ToString()); - summary.Add("repairFilm2", repairFilm2.ToString()); - summary.Add("RepairJoint3", RepairJoint3.ToString()); - summary.Add("repairFilm3", repairFilm3.ToString()); - summary.Add("JointPassRate", jointPassRate.ToString()); - summary.Add("JointFilmPassRate", filmPassRate.ToString()); + if (this.drpSteel.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@steel", this.drpSteel.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@steel", null)); + } + if (this.drpWloName.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@WED_ID", this.drpWloName.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@WED_ID", null)); + } - Grid1.SummaryData = summary; + if (!string.IsNullOrEmpty(this.txtStarTime.Text)) + { + listStr.Add(new SqlParameter("@date1", Convert.ToDateTime(this.txtStarTime.Text))); + } + else + { + listStr.Add(new SqlParameter("@date1", null)); + } + + if (!string.IsNullOrEmpty(this.txtEndTime.Text)) + { + listStr.Add(new SqlParameter("@date2", Convert.ToDateTime(this.txtEndTime.Text).AddDays(1))); + } + else + { + listStr.Add(new SqlParameter("@date2", null)); + } + + if (this.drpProject.SelectedValueArray.Length > 0 && this.drpProject.SelectedValueArray[0] != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@projectId", projectIds)); + } + else + { + listStr.Add(new SqlParameter("@projectId", null)); + } + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tbSum = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_welderPerformanceSum", parameter); + if (tbSum.Rows.Count > 0) + { + JObject summary = new JObject(); + summary.Add("tfNumber", "合计"); + summary.Add("totalJoint", tbSum.Rows[0]["totalJoint"].ToString()); + summary.Add("totalSize", tbSum.Rows[0]["totalSize"].ToString()); + summary.Add("JointNum1", tbSum.Rows[0]["JointNum1"].ToString()); + summary.Add("totalfilm", tbSum.Rows[0]["totalfilm"].ToString()); + summary.Add("JointPassNum1", tbSum.Rows[0]["JointPassNum1"].ToString()); + summary.Add("totalPassfilm", tbSum.Rows[0]["totalPassfilm"].ToString()); + + summary.Add("RepairJoint1", tbSum.Rows[0]["RepairJoint1"].ToString()); + summary.Add("repairFilm1", tbSum.Rows[0]["repairFilm1"].ToString()); + summary.Add("RepairJoint2", tbSum.Rows[0]["RepairJoint2"].ToString()); + summary.Add("repairFilm2", tbSum.Rows[0]["repairFilm2"].ToString()); + summary.Add("RepairJoint3", tbSum.Rows[0]["RepairJoint3"].ToString()); + summary.Add("repairFilm3", tbSum.Rows[0]["repairFilm3"].ToString()); + summary.Add("JointPassRate", (Funs.GetNewDecimalOrZero(tbSum.Rows[0]["JointPassRate"].ToString()) * 100).ToString("0.00") + "%"); + summary.Add("JointFilmPassRate", (Funs.GetNewDecimalOrZero(tbSum.Rows[0]["JointFilmPassRate"].ToString()) * 100).ToString("0.00") + "%"); + + Grid1.SummaryData = summary; + } } } @@ -207,6 +277,84 @@ Grid1.DataBind(); } + /// + /// 绑定数据 + /// + private void BindGrid2() + { + string projectIds = String.Join(",", drpProject.SelectedValueArray); + List listStr = new List(); + + if (this.drpIns.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@installationId", this.drpIns.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@installationId", null)); + } + + if (this.drpUnit.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@unitcode", this.drpUnit.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@unitcode", null)); + } + + if (this.drpSteel.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@steel", this.drpSteel.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@steel", null)); + } + if (this.drpWloName.SelectedValue != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@WED_ID", this.drpWloName.SelectedValue)); + } + else + { + listStr.Add(new SqlParameter("@WED_ID", null)); + } + + if (!string.IsNullOrEmpty(this.txtStarTime.Text)) + { + listStr.Add(new SqlParameter("@date1", Convert.ToDateTime(this.txtStarTime.Text))); + } + else + { + listStr.Add(new SqlParameter("@date1", null)); + } + + if (!string.IsNullOrEmpty(this.txtEndTime.Text)) + { + listStr.Add(new SqlParameter("@date2", Convert.ToDateTime(this.txtEndTime.Text).AddDays(1))); + } + else + { + listStr.Add(new SqlParameter("@date2", null)); + } + + if (this.drpProject.SelectedValueArray.Length > 0 && this.drpProject.SelectedValueArray[0] != BLL.Const._Null) + { + listStr.Add(new SqlParameter("@projectId", projectIds)); + } + else + { + listStr.Add(new SqlParameter("@projectId", null)); + } + + SqlParameter[] parameter = listStr.ToArray(); + tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_welderPerformance2", parameter); + this.Grid1.RecordCount = tb.Rows.Count; + tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } #endregion #region 分页 @@ -253,6 +401,17 @@ BindGrid(); OutputSummaryData(); } + + /// + /// 统计 + /// + /// + /// + protected void BtnAnalyse2_Click(object sender, EventArgs e) + { + BindGrid2(); + OutputSummaryData(); + } #endregion #region 导出按钮 diff --git a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.designer.cs index 3694dad..e1cd877 100644 --- a/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/HJGL/WeldingReport/WelderPerformance.aspx.designer.cs @@ -147,6 +147,15 @@ namespace FineUIPro.Web.HJGL.WeldingReport { /// protected global::FineUIPro.ToolbarFill ToolbarFill1; + /// + /// BtnAnalyse2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button BtnAnalyse2; + /// /// BtnAnalyse 控件。 ///