feat: 性能优化与功能增强

- 优化TestPackageData的InitTreeMenu方法,减少数据库查询次数
  - InstallList页面新增数据汇总统计功能
  - 修复SetSubReviewEdit2编辑时编号重复误报的bug
This commit is contained in:
2025-12-22 12:26:03 +08:00
parent 588fd6124c
commit 808beba1fd
7 changed files with 179 additions and 72 deletions
@@ -220,6 +220,61 @@ namespace FineUIPro.Web.HJGL.PreDesign
var table = view_HJGL_InstallDatas;
Grid1.DataSource = table;
Grid1.DataBind();
// 更新汇总信息
UpdateSummary();
}
/// <summary>
/// 更新汇总信息
/// </summary>
private void UpdateSummary()
{
try
{
var baseQuery = from x in Funs.DB.View_HJGL_InstallData select x;
// 应用与数据绑定相同的筛选条件
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
}
else if (tvControlItem.SelectedNode.CommandName == "流水段")
{
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text);
}
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
{
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim()));
}
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
{
baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim()));
}
if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue))
{
baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue));
}
if (!string.IsNullOrEmpty(txtPipelineCode.Text))
{
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
}
// 计算汇总数据
var componentCount = baseQuery.Count(x => x.TypeStr == "预制组件");
var partCount = baseQuery.Count(x => x.TypeStr == "预制散件");
// 更新汇总标签
lblSummary1.Text = $"预制组件数量:{componentCount}";
lblSummary2.Text = $"预制散件数量:{partCount}";
}
catch (Exception ex)
{
// 出现异常时显示默认值
lblSummary1.Text = "预制组件数量:0";
lblSummary2.Text = "预制散件数量:0";
}
}
/// <summary>