From 968638ee2b07d92d79284a0e57ca5e44166f1b27 Mon Sep 17 00:00:00 2001 From: yhw0507 Date: Wed, 29 Mar 2023 11:01:27 +0800 Subject: [PATCH] =?UTF-8?q?20230329=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataShow/ConstructionEquipment.aspx | 6 +- .../DataShow/QualityProblem.aspx | 38 +++-- .../DataShow/QualityProblem.aspx.cs | 150 ++++++++++++++---- .../DataShow/QualityProblem.aspx.designer.cs | 36 +++++ 4 files changed, 177 insertions(+), 53 deletions(-) diff --git a/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx b/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx index 373bc94f..3744fc54 100644 --- a/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx +++ b/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx @@ -42,7 +42,7 @@ Width="130px"> - + @@ -120,13 +120,13 @@ } // 点击标题栏工具图标 - 退出 - function close(event) { + function closeNew(event) { var bConfirmed = confirm('您确定要退出吗?'); if (bConfirmed) { closePage(); } } function closePage() { - if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) { + if (navigator.userAgent.indexOf("Firefox") !== -1 || navigator.userAgent.indexOf("Chrome") !== -1) { window.location.href = "about:blank"; window.close(); } else { diff --git a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx index 3d6739a8..afcc2ff6 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx +++ b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx @@ -34,8 +34,8 @@ - - + + @@ -52,19 +52,27 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -83,7 +91,7 @@ diff --git a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs index b131201c..34518658 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.Linq; namespace FineUIPro.Web.DataShow { @@ -32,50 +33,30 @@ namespace FineUIPro.Web.DataShow /// private void BindGrid() { - string strSql = @"select NEWID() as ID, v.ProjectId,v.ProjectCode,v.ProjectName,v.allcount,v.ccount,isnull(v.allCount,0)-ISNULL(v.cCount,0) as ucCount, - (case when isnull(v.allCount,0) > 0 then cast((isnull(v.allCount,0)-ISNULL(v.cCount,0)) *1.0 /isnull(v.allCount,0)*100 as decimal(18, 2)) - else 0 end) as rateV - from (select h.ProjectId,p.ProjectCode,p.ProjectName,COUNT(*) as allCount, - isnull((select COUNT(*) from Check_CheckControl as c - where c.ProjectId=h.ProjectId and State =7 - and '1' = @cpara - group by c.ProjectId),0) as cCount - from Check_CheckControl as h - left join Base_Project as p on h.ProjectId=p.ProjectId - where p.projectId is not null "; + string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1"; List listStr = new List(); string cpara = string.Empty; if (this.drpProject.SelectedValue != Const._Null) { - strSql += " AND h.projectId = @projectId"; ///状态为已完成 + strSql += " AND projectId = @projectId"; ///状态为已完成 listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue)); - - cpara += " AND c.projectId ="+ this.drpProject.SelectedValue; } - if (!string.IsNullOrEmpty(this.txtStartTime.Text)) - { - strSql += " AND h.CheckDate >=@StartTime"; - listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text)); + //if (!string.IsNullOrEmpty(this.txtStartTime.Text)) + //{ + // strSql += " AND h.RegisterDate >=@StartTime"; + // listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text)); - cpara += " AND c.CheckDate >=" + this.txtStartTime.Text; - } - if (!string.IsNullOrEmpty(this.txtEndTime.Text)) - { - strSql += " AND h.CheckDate <=@EndTime"; - listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text)); + // cpara += " AND c.RegisterDate >=" + this.txtStartTime.Text; + //} + //if (!string.IsNullOrEmpty(this.txtEndTime.Text)) + //{ + // strSql += " AND h.RegisterDate <=@EndTime"; + // listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text)); + + // cpara += " AND c.RegisterDate <=" + this.txtEndTime.Text; + //} - cpara += " AND c.CheckDate <=" + this.txtEndTime.Text; - } - if (!string.IsNullOrEmpty(cpara)) - { - listStr.Add(new SqlParameter("@cpara"," '1' And "+ cpara)); - } - else - { - listStr.Add(new SqlParameter("@cpara", "'1'")); - } - strSql += " group by h.ProjectId,p.ProjectCode,p.ProjectName) as v"; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); Grid1.RecordCount = tb.Rows.Count; @@ -172,5 +153,104 @@ namespace FineUIPro.Web.DataShow { EditData(); } + + + /// + /// 数量 + /// + /// + /// + protected int Count1(object projectId) + { + int cout1 = 0; + if (projectId != null) + { + var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); + var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); + var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString()); + if (datetime1.HasValue) + { + getT = getT.Where(x => x.CheckDate >= datetime1); + } + if (datetime2.HasValue) + { + getT = getT.Where(x => x.CheckDate <= datetime2); + } + + cout1 = getT.Count(); + } + return cout1; + } + + protected int Count2(object projectId) + { + int cout1 = 0; + if (projectId != null) + { + var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); + var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); + var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State == "7"); + if (datetime1.HasValue) + { + getT = getT.Where(x => x.CheckDate >= datetime1); + } + if (datetime2.HasValue) + { + getT = getT.Where(x => x.CheckDate <= datetime2); + } + + cout1 = getT.Count(); + } + return cout1; + } + + protected int Count3(object projectId) + { + int cout1 = 0; + if (projectId != null) + { + var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); + var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); + var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State != "7"); + if (datetime1.HasValue) + { + getT = getT.Where(x => x.CheckDate >= datetime1); + } + if (datetime2.HasValue) + { + getT = getT.Where(x => x.CheckDate <= datetime2); + } + cout1 = getT.Count(); + } + return cout1; + } + + protected string Count4(object projectId) + { + string rate = string.Empty; + if (projectId != null) + { + var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); + var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); + var getALL = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString()); + + if (datetime1.HasValue) + { + getALL = getALL.Where(x => x.CheckDate >= datetime1); + } + if (datetime2.HasValue) + { + getALL = getALL.Where(x => x.CheckDate >= datetime1); + } + var getT = getALL.Where(x => x.ProjectId == projectId.ToString() && x.State == "7"); + int coutall = getALL.Count(); + int cout0 = getT.Count(); + if (coutall > 0) + { + rate = Math.Round(cout0 * 1.0 / coutall * 100, 2).ToString(); + } + } + return rate; + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.designer.cs b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.designer.cs index 5c220053..ab3a76bc 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.designer.cs @@ -113,6 +113,42 @@ namespace FineUIPro.Web.DataShow /// protected global::System.Web.UI.WebControls.Label labNumber; + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// Label4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label4; + + /// + /// Label5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label5; + /// /// ToolbarSeparator1 控件。 ///