From 8c55c6f4704715df0489176241bec45aaa66722f Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Tue, 1 Apr 2025 09:31:32 +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 --- .../CQMS/QuantityManagement/BaseService.cs | 117 ++++++++++++++++++ .../CQMS/QuantityManagement/Base.aspx | 22 ++-- .../CQMS/QuantityManagement/Base.aspx.cs | 5 +- .../WorkTeamStatistics.aspx | 3 - .../WorkTeamStatistics.aspx.cs | 2 +- 5 files changed, 133 insertions(+), 16 deletions(-) diff --git a/SGGL/BLL/CQMS/QuantityManagement/BaseService.cs b/SGGL/BLL/CQMS/QuantityManagement/BaseService.cs index 2695f8e..2af0443 100644 --- a/SGGL/BLL/CQMS/QuantityManagement/BaseService.cs +++ b/SGGL/BLL/CQMS/QuantityManagement/BaseService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Collections; using System.Web.UI.WebControls; +using System.Data; namespace BLL { @@ -269,5 +270,121 @@ namespace BLL else return null; } + + /// + /// 获取模拟树表格 + /// + /// + public static DataTable GetAllTreeDataTable(string projectId) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + IQueryable cNProfessionals = from x in db.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId orderby x.SortIndex select x; + IQueryable bases = from x in db.View_QuantityManagement_Base where x.ProjectId == projectId select x; + DataTable table = new DataTable(); + table.Columns.Add(new DataColumn("BaseId", typeof(String))); + table.Columns.Add(new DataColumn("SupId", typeof(String))); + table.Columns.Add(new DataColumn("Name", typeof(String))); + table.Columns.Add(new DataColumn("ProjectId", typeof(String))); + table.Columns.Add(new DataColumn("DrawingNo", typeof(String))); + table.Columns.Add(new DataColumn("DrawingName", typeof(String))); + table.Columns.Add(new DataColumn("Part", typeof(String))); + table.Columns.Add(new DataColumn("ProjectContent", typeof(String))); + table.Columns.Add(new DataColumn("Unit", typeof(String))); + table.Columns.Add(new DataColumn("Amount", typeof(decimal))); + table.Columns.Add(new DataColumn("WorkTeam", typeof(String))); + table.Columns.Add(new DataColumn("State", typeof(String))); + + DataRow row; + row = table.NewRow(); + row[0] = "0"; + row[1] = null; + row[2] = "工程量基础表"; + row[3] = projectId; + row[4] = ""; + row[5] = ""; + row[6] = ""; + row[7] = ""; + row[8] = ""; + row[9] = DBNull.Value; + row[10] = ""; + row[11] = ""; + table.Rows.Add(row); + foreach (var item in cNProfessionals) + { + row = table.NewRow(); + row[0] = item.CNProfessionalId; + row[1] = "0"; + row[2] = item.ProfessionalName; + row[3] = projectId; + row[4] = ""; + row[5] = ""; + row[6] = ""; + row[7] = ""; + row[8] = ""; + row[9] = DBNull.Value; + row[10] = ""; + row[11] = ""; + table.Rows.Add(row); + var workSections = bases.Where(x => x.Major == item.ProfessionalName).Select(x => x.WorkSection).Distinct().ToList(); + foreach (var workSection in workSections) + { + row = table.NewRow(); + row[0] = item.CNProfessionalId + workSection; + row[1] = item.CNProfessionalId; + row[2] = workSection; + row[3] = projectId; + row[4] = ""; + row[5] = ""; + row[6] = ""; + row[7] = ""; + row[8] = ""; + row[9] = DBNull.Value; + row[10] = ""; + row[11] = ""; + table.Rows.Add(row); + var bs = from x in bases + where x.WorkSection == workSection && x.Major == item.ProfessionalName + orderby x.DrawingNo, x.Part, x.WorkSection + select x; + foreach (var b in bs) + { + row = table.NewRow(); + row[0] = b.BaseId; + row[1] = item.CNProfessionalId + workSection; + row[2] = b.Part; + row[3] = projectId; + row[4] = b.DrawingNo; + row[5] = b.DrawingName; + row[6] = b.Part; + row[7] = b.ProjectContent; + row[8] = b.Unit; + row[9] = b.Amount; + row[10] = b.WorkTeam; + row[11] = b.State; + table.Rows.Add(row); + } + } + } + //foreach (var item in bases) + //{ + // row = table.NewRow(); + // row[0] = item.BaseId; + // row[1] = "0"; + // row[2] = item.ProfessionalName; + // row[3] = projectId; + // row[4] = ""; + // row[5] = ""; + // row[6] = ""; + // row[7] = ""; + // row[8] = ""; + // row[9] = DBNull.Value; + // row[10] = ""; + // row[11] = ""; + // table.Rows.Add(row); + //} + return table; + } + } } } diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx index 748e3e6..e4a4769 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx @@ -13,8 +13,8 @@ - - + + <%-- + --%> - - - --%> + <%-- - - - + --%> diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs index c9fd669..8c1b871 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/Base.aspx.cs @@ -20,7 +20,10 @@ namespace FineUIPro.Web.CQMS.QuantityManagement if (!IsPostBack) { GetButtonPower(); - BindGrid(); + DataTable table = BLL.BaseService.GetAllTreeDataTable(this.CurrUser.LoginProjectId); + Grid1.DataSource = table; + Grid1.DataBind(); + //BindGrid(); } } diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx index 53fff5f..a12cc80 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx @@ -60,9 +60,6 @@ - - diff --git a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs index b4d14fe..c477d70 100644 --- a/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/QuantityManagement/WorkTeamStatistics.aspx.cs @@ -113,7 +113,7 @@ namespace FineUIPro.Web.CQMS.QuantityManagement } completedAmount= totalDayInputs.Where(x => x.WorkSection == workSection && x.ProjectContent == projectContent && x.WorkTeam == workTeam).ToList().Sum(x => x.DayAmount ?? 0); totalCompletedAmount = totalDayInputs.Where(x => x.WorkSection == workSection && x.ProjectContent == projectContent).ToList().Sum(x => x.DayAmount ?? 0); - this.Grid1.Rows[i].Values[4] = totalAmount.ToString("0.##"); + this.Grid1.Rows[i].Values[5] = totalAmount.ToString("0.##"); this.Grid1.Rows[i].Values[6] = completedAmount.ToString("0.##"); this.Grid1.Rows[i].Values[7] = (totalAmount - totalCompletedAmount).ToString("0.##"); this.Grid1.Rows[i].Values[8] = monthComplete.ToString("0.##");