From a75ba9f44a99a8f98f0b6e36193786502c9df9b4 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Mon, 12 May 2025 10:20:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/BaseInfo/CNProfessionalService.cs | 29 ++++++++++ .../CQMS/QuantityManagement/Base.aspx | 9 ++- .../CQMS/QuantityManagement/Base.aspx.cs | 21 ++++--- .../QuantityManagement/Base.aspx.designer.cs | 12 ++-- .../CQMS/QuantityManagement/DayInput.aspx | 9 ++- .../CQMS/QuantityManagement/DayInput.aspx.cs | 21 ++++--- .../DayInput.aspx.designer.cs | 12 ++-- .../DayInputStatistics.aspx.cs | 2 +- .../ProjectContentStatistics.aspx | 2 +- .../ProjectContentStatistics.aspx.cs | 52 +++++++++++++++++- .../WorkTeamStatistics.aspx | 2 +- .../WorkTeamStatistics.aspx.cs | 55 ++++++++++++++++++- 12 files changed, 185 insertions(+), 41 deletions(-) diff --git a/SGGL/BLL/BaseInfo/CNProfessionalService.cs b/SGGL/BLL/BaseInfo/CNProfessionalService.cs index 43ca431..f11ef80 100644 --- a/SGGL/BLL/BaseInfo/CNProfessionalService.cs +++ b/SGGL/BLL/BaseInfo/CNProfessionalService.cs @@ -81,6 +81,17 @@ namespace BLL Funs.FineUIPleaseSelect(dropName); } } + public static void InitDistinctCNProfessionalDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease) + { + dropName.DataValueField = "Value"; + dropName.DataTextField = "Text"; + dropName.DataSource = GetDistinctCNProfessionalItem(projectId); + dropName.DataBind(); + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } /// /// 专业下拉框 /// @@ -113,6 +124,24 @@ namespace BLL return list; } + /// + /// 获取专业集合 + /// + /// + public static ListItem[] GetDistinctCNProfessionalItem(string projectId) + { + Model.SGGLDB db = Funs.DB; + var bases = from x in db.View_QuantityManagement_Base where x.ProjectId == projectId select x; + var cnNames = bases.Select(x => x.Major).Distinct().ToList(); + var q = (from x in db.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && cnNames.Contains(x.ProfessionalName) orderby x.SortIndex select x).ToList(); + ListItem[] list = new ListItem[q.Count()]; + for (int i = 0; i < q.Count(); i++) + { + list[i] = new ListItem(q[i].ProfessionalName ?? "", q[i].CNProfessionalId); + } + return list; + } + /// /// 获取一个专业信息 /// diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx index e9c580a..4f001bf 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx @@ -42,9 +42,12 @@ - - - + + + + + + diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs index eda94ce..7036350 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs @@ -19,6 +19,9 @@ namespace FineUIPro.Web.CQMS.QuantityManagement { if (!IsPostBack) { + BLL.DrawingService.InitDrawingChangeDropDownList(drpDrawingNo, this.CurrUser.LoginProjectId, true); + BLL.BaseService.InitAllPartDropDownList(this.drpPart, this.CurrUser.LoginProjectId, true); + BLL.BaseService.InitAllProjectContentDropDownList(this.drpProjectContent, this.CurrUser.LoginProjectId, true); GetButtonPower(); InitTreeMenu(); } @@ -108,20 +111,20 @@ namespace FineUIPro.Web.CQMS.QuantityManagement List listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); listStr.Add(new SqlParameter("@WorkSection", this.trWBS.SelectedNodeID)); - if (!string.IsNullOrEmpty(this.txtDrawingNo.Text.Trim())) + if (this.drpDrawingNo.SelectedValue != BLL.Const._Null) { - strSql += " AND DrawingNo like @DrawingNo"; - listStr.Add(new SqlParameter("@DrawingNo", "%" + this.txtDrawingNo.Text.Trim() + "%")); + strSql += " AND DrawingId = @DrawingId"; + listStr.Add(new SqlParameter("@DrawingId", this.drpDrawingNo.SelectedValue)); } - if (!string.IsNullOrEmpty(this.txtPart.Text.Trim())) + if (this.drpPart.SelectedValue != BLL.Const._Null) { - strSql += " AND Part like @Part"; - listStr.Add(new SqlParameter("@Part", "%" + this.txtPart.Text.Trim() + "%")); + strSql += " AND Part = @Part"; + listStr.Add(new SqlParameter("@Part", this.drpPart.SelectedItem.Text)); } - if (!string.IsNullOrEmpty(this.txtProjectContent.Text.Trim())) + if (this.drpProjectContent.SelectedValue != BLL.Const._Null) { - strSql += " AND ProjectContent like @ProjectContent"; - listStr.Add(new SqlParameter("@ProjectContent", "%" + this.txtProjectContent.Text.Trim() + "%")); + strSql += " AND ProjectContent = @ProjectContent"; + listStr.Add(new SqlParameter("@ProjectContent", this.drpProjectContent.SelectedItem.Text)); } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.designer.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.designer.cs index d21f374..5e5279f 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.designer.cs @@ -94,31 +94,31 @@ namespace FineUIPro.Web.CQMS.QuantityManagement { protected global::FineUIPro.Toolbar ToolSearch; /// - /// txtDrawingNo 控件。 + /// drpDrawingNo 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtDrawingNo; + protected global::FineUIPro.DropDownList drpDrawingNo; /// - /// txtPart 控件。 + /// drpPart 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtPart; + protected global::FineUIPro.DropDownList drpPart; /// - /// txtProjectContent 控件。 + /// drpProjectContent 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtProjectContent; + protected global::FineUIPro.DropDownList drpProjectContent; /// /// btnSearch 控件。 diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx index c3315f8..27f5041 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx @@ -22,9 +22,12 @@ - - - + + + + + + diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.cs index 89f95b5..ccb9a9b 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.cs @@ -19,6 +19,9 @@ namespace FineUIPro.Web.CQMS.QuantityManagement { if (!IsPostBack) { + BLL.DrawingService.InitDrawingChangeDropDownList(drpDrawingNo, this.CurrUser.LoginProjectId, true); + BLL.BaseService.InitAllPartDropDownList(this.drpPart, this.CurrUser.LoginProjectId, true); + BLL.BaseService.InitAllProjectContentDropDownList(this.drpProjectContent, this.CurrUser.LoginProjectId, true); GetButtonPower(); BindGrid(); } @@ -33,20 +36,20 @@ namespace FineUIPro.Web.CQMS.QuantityManagement where C.ProjectId = @ProjectId"; List listStr = new List(); listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); - if (!string.IsNullOrEmpty(this.txtDrawingNo.Text.Trim())) + if (this.drpDrawingNo.SelectedValue != BLL.Const._Null) { - strSql += " AND DrawingNo like @DrawingNo"; - listStr.Add(new SqlParameter("@DrawingNo", "%" + this.txtDrawingNo.Text.Trim() + "%")); + strSql += " AND DrawingId = @DrawingId"; + listStr.Add(new SqlParameter("@DrawingId", this.drpDrawingNo.SelectedValue)); } - if (!string.IsNullOrEmpty(this.txtPart.Text.Trim())) + if (this.drpPart.SelectedValue != BLL.Const._Null) { - strSql += " AND Part like @Part"; - listStr.Add(new SqlParameter("@Part", "%" + this.txtPart.Text.Trim() + "%")); + strSql += " AND Part = @Part"; + listStr.Add(new SqlParameter("@Part", this.drpPart.SelectedItem.Text)); } - if (!string.IsNullOrEmpty(this.txtProjectContent.Text.Trim())) + if (this.drpProjectContent.SelectedValue != BLL.Const._Null) { - strSql += " AND ProjectContent like @ProjectContent"; - listStr.Add(new SqlParameter("@ProjectContent", "%" + this.txtProjectContent.Text.Trim() + "%")); + strSql += " AND ProjectContent = @ProjectContent"; + listStr.Add(new SqlParameter("@ProjectContent", this.drpProjectContent.SelectedItem.Text)); } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.designer.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.designer.cs index 0a7fe27..5520aba 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInput.aspx.designer.cs @@ -58,31 +58,31 @@ namespace FineUIPro.Web.CQMS.QuantityManagement { protected global::FineUIPro.Toolbar ToolSearch; /// - /// txtDrawingNo 控件。 + /// drpDrawingNo 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtDrawingNo; + protected global::FineUIPro.DropDownList drpDrawingNo; /// - /// txtPart 控件。 + /// drpPart 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtPart; + protected global::FineUIPro.DropDownList drpPart; /// - /// txtProjectContent 控件。 + /// drpProjectContent 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtProjectContent; + protected global::FineUIPro.DropDownList drpProjectContent; /// /// btnSearch 控件。 diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInputStatistics.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInputStatistics.aspx.cs index f223ebb..171a6e8 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInputStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/DayInputStatistics.aspx.cs @@ -119,7 +119,7 @@ namespace FineUIPro.Web.CQMS.QuantityManagement } BLL.DrawingService.InitWorkSectionDropDownList(drpWorkSection, projectId, true); BLL.DrawingService.InitDrawingChangeDropDownList(drpDrawingNo, projectId, true); - BLL.CNProfessionalService.InitCNProfessionalDownList(drpMajor, true); + BLL.CNProfessionalService.InitDistinctCNProfessionalDownList(drpMajor, projectId, true); BLL.BaseService.InitAllPartDropDownList(this.drpPart, projectId, true); BLL.BaseService.InitAllProjectContentDropDownList(this.drpProjectContent, projectId, true); BLL.TeamGroupService.InitTeamGroupProjectDropDownList(drpWorkTeam, projectId, true); diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx index 76231d1..5f430f3 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx @@ -16,7 +16,7 @@ diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx.cs index 580a56b..6c8d5a7 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/ProjectContentStatistics.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using NPOI.SS.Util; using System; using System.Collections.Generic; @@ -32,7 +33,7 @@ namespace FineUIPro.Web.CQMS.QuantityManagement this.drpProject.Hidden = true; projectId = this.drpProject.SelectedValue; } - BLL.CNProfessionalService.InitCNProfessionalDownList(drpMajor, true); + BLL.CNProfessionalService.InitDistinctCNProfessionalDownList(drpMajor, projectId, true); BLL.BaseService.InitAllProjectContentDropDownList(this.drpProjectContent, projectId, true); GetButtonPower(); BindGrid(); @@ -124,6 +125,27 @@ namespace FineUIPro.Web.CQMS.QuantityManagement this.Grid1.Rows[i].Values[8] = decimal.Round(completedAmount / totalAmount, 4) * 100; } } + OutputSummaryData(); + } + + /// + /// 全部行合计 + /// + private void OutputSummaryData() + { + if (this.Grid1.Rows.Count > 0) + { + decimal d = 0; + for (int i = 0; i < this.Grid1.Rows.Count; i++) + { + d += Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[8].ToString()); + } + JObject summary = new JObject(); + summary.Add("MonthComplete", "合计"); + summary.Add("CompleteRate", decimal.Round(d / this.Grid1.Rows.Count, 2).ToString()); + Grid1.SummaryData = summary; + } + } #endregion @@ -333,6 +355,34 @@ namespace FineUIPro.Web.CQMS.QuantityManagement cell.CellStyle = cellStyle; cell.SetCellValue(Grid1.Rows[i].Values[8].ToString()); } + row = sheet.CreateRow(r + Grid1.Rows.Count); + cell = row.CreateCell(0); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(1); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(2); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(3); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(4); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(5); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(6); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(7); + cell.CellStyle = cellStyle; + cell.SetCellValue("合计"); + cell = row.CreateCell(8); + cell.CellStyle = cellStyle; + cell.SetCellValue(Grid1.SummaryData["CompleteRate"].ToString()); // 第三步:写入文件流 using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write)) { diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx index 4bbeb90..49a6c94 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx @@ -16,7 +16,7 @@ diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs index 0ecd9f0..2acdae5 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using NPOI.SS.Util; using System; using System.Collections.Generic; @@ -33,7 +34,7 @@ namespace FineUIPro.Web.CQMS.QuantityManagement projectId = this.drpProject.SelectedValue; } BLL.DrawingService.InitWorkSectionDropDownList(drpWorkSection, projectId, true); - BLL.CNProfessionalService.InitCNProfessionalDownList(drpMajor, true); + BLL.CNProfessionalService.InitDistinctCNProfessionalDownList(drpMajor, projectId, true); BLL.BaseService.InitAllProjectContentDropDownList(this.drpProjectContent, projectId, true); GetButtonPower(); @@ -132,6 +133,27 @@ namespace FineUIPro.Web.CQMS.QuantityManagement this.Grid1.Rows[i].Values[9] = decimal.Round(completedAmount / totalAmount, 4) * 100; } } + OutputSummaryData(); + } + + /// + /// 全部行合计 + /// + private void OutputSummaryData() + { + if (this.Grid1.Rows.Count > 0) + { + decimal d=0; + for (int i = 0; i < this.Grid1.Rows.Count; i++) + { + d += Funs.GetNewDecimalOrZero(this.Grid1.Rows[i].Values[9].ToString()); + } + JObject summary = new JObject(); + summary.Add("MonthComplete", "合计"); + summary.Add("CompleteRate", decimal.Round(d / this.Grid1.Rows.Count, 2).ToString()); + Grid1.SummaryData = summary; + } + } #endregion @@ -344,6 +366,37 @@ namespace FineUIPro.Web.CQMS.QuantityManagement cell.CellStyle = cellStyle; cell.SetCellValue(Grid1.Rows[i].Values[9].ToString()); } + row = sheet.CreateRow(r + Grid1.Rows.Count); + cell = row.CreateCell(0); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(1); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(2); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(3); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(4); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(5); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(6); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(7); + cell.CellStyle = cellStyle; + cell.SetCellValue(string.Empty); + cell = row.CreateCell(8); + cell.CellStyle = cellStyle; + cell.SetCellValue("合计"); + cell = row.CreateCell(9); + cell.CellStyle = cellStyle; + cell.SetCellValue(Grid1.SummaryData["CompleteRate"].ToString()); // 第三步:写入文件流 using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write)) {