提交代码

This commit is contained in:
高飞 2025-05-12 10:20:13 +08:00
parent 3b18178e30
commit a75ba9f44a
12 changed files with 185 additions and 41 deletions

View File

@ -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);
}
}
/// <summary>
/// 专业下拉框
/// </summary>
@ -113,6 +124,24 @@ namespace BLL
return list;
}
/// <summary>
/// 获取专业集合
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// 获取一个专业信息
/// </summary>

View File

@ -42,9 +42,12 @@
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtDrawingNo" Label="图号" LabelWidth="60px" LabelAlign="Right"></f:TextBox>
<f:TextBox runat="server" ID="txtPart" Label="部位" LabelWidth="60px" LabelAlign="Right"></f:TextBox>
<f:TextBox runat="server" ID="txtProjectContent" Label="项目内容" LabelWidth="100px" LabelAlign="Right"></f:TextBox>
<f:DropDownList ID="drpDrawingNo" runat="server" LabelWidth="60px" Required="true" Label="图号" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpPart" runat="server" LabelWidth="60px" Required="true" Label="部位" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpProjectContent" runat="server" LabelWidth="100px" Required="true" Label="项目内容" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:Button ID="btnSearch" Icon="SystemSearch" EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="查询">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>

View File

@ -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<SqlParameter> listStr = new List<SqlParameter>();
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);

View File

@ -94,31 +94,31 @@ namespace FineUIPro.Web.CQMS.QuantityManagement {
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// txtDrawingNo 控件。
/// drpDrawingNo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtDrawingNo;
protected global::FineUIPro.DropDownList drpDrawingNo;
/// <summary>
/// txtPart 控件。
/// drpPart 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPart;
protected global::FineUIPro.DropDownList drpPart;
/// <summary>
/// txtProjectContent 控件。
/// drpProjectContent 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtProjectContent;
protected global::FineUIPro.DropDownList drpProjectContent;
/// <summary>
/// btnSearch 控件。

View File

@ -22,9 +22,12 @@
<Toolbars>
<f:Toolbar ID="ToolSearch" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtDrawingNo" Label="图号" LabelWidth="60px" LabelAlign="Right"></f:TextBox>
<f:TextBox runat="server" ID="txtPart" Label="部位" LabelWidth="60px" LabelAlign="Right"></f:TextBox>
<f:TextBox runat="server" ID="txtProjectContent" Label="项目内容" LabelWidth="100px" LabelAlign="Right"></f:TextBox>
<f:DropDownList ID="drpDrawingNo" runat="server" LabelWidth="60px" Required="true" Label="图号" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpPart" runat="server" LabelWidth="60px" Required="true" Label="部位" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpProjectContent" runat="server" LabelWidth="100px" Required="true" Label="项目内容" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:Button ID="btnSearch" Icon="SystemSearch" EnablePostBack="true" runat="server" OnClick="btnSearch_Click" ToolTip="查询">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>

View File

@ -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<SqlParameter> listStr = new List<SqlParameter>();
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);

View File

@ -58,31 +58,31 @@ namespace FineUIPro.Web.CQMS.QuantityManagement {
protected global::FineUIPro.Toolbar ToolSearch;
/// <summary>
/// txtDrawingNo 控件。
/// drpDrawingNo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtDrawingNo;
protected global::FineUIPro.DropDownList drpDrawingNo;
/// <summary>
/// txtPart 控件。
/// drpPart 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPart;
protected global::FineUIPro.DropDownList drpPart;
/// <summary>
/// txtProjectContent 控件。
/// drpProjectContent 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtProjectContent;
protected global::FineUIPro.DropDownList drpProjectContent;
/// <summary>
/// btnSearch 控件。

View File

@ -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);

View File

@ -16,7 +16,7 @@
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="工程量基础表" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true" ForceFit="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="Major,ProjectContent"
SortDirection="DESC" OnSort="Grid1_Sort"
SortDirection="DESC" OnSort="Grid1_Sort" EnableSummary="true" SummaryPosition="Flow"
AllowPaging="false" IsDatabasePaging="true" PageSize="10000"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
<Toolbars>

View File

@ -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();
}
/// <summary>
/// 全部行合计
/// </summary>
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))
{

View File

@ -16,7 +16,7 @@
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="工程量基础表" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" EnableColumnLines="true" ForceFit="true"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="WorkSection,ProjectContent"
SortDirection="DESC" OnSort="Grid1_Sort"
SortDirection="DESC" OnSort="Grid1_Sort" EnableSummary="true" SummaryPosition="Flow"
AllowPaging="false" IsDatabasePaging="true" PageSize="10000"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="true">
<Toolbars>

View File

@ -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();
}
/// <summary>
/// 全部行合计
/// </summary>
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))
{