From 588fd6124cb6b3107ea7f45e378e2212b4c500b3 Mon Sep 17 00:00:00 2001
From: fei550 <1420031550@qq.com>
Date: Mon, 22 Dec 2025 12:22:12 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=88=E5=90=8C=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ContractCompile/ContractReviewService.cs | 28 +++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/SGGL/BLL/PHTGL/ContractCompile/ContractReviewService.cs b/SGGL/BLL/PHTGL/ContractCompile/ContractReviewService.cs
index 6afb389e..264057b4 100644
--- a/SGGL/BLL/PHTGL/ContractCompile/ContractReviewService.cs
+++ b/SGGL/BLL/PHTGL/ContractCompile/ContractReviewService.cs
@@ -659,12 +659,36 @@ namespace BLL
string projectname = ProjectService.GetProjectNameByProjectId(getFireWork.ProjectId);
string rootPath = Funs.RootPath;
- string startPath = rootPath + "File\\Word\\PHTGL\\" + getFireWork.ContractNum + "-" + projectname + "-" + getFireWork.ContractName + "-合同管理资料";
+ // 清理路径中的非法字符
+ string CleanFileName(string input)
+ {
+ if (string.IsNullOrEmpty(input)) return "Unknown";
+
+ char[] invalidChars = Path.GetInvalidFileNameChars();
+ char[] invalidPathChars = Path.GetInvalidPathChars();
+
+ string result = input;
+ foreach (char c in invalidChars)
+ {
+ result = result.Replace(c.ToString(), "_");
+ }
+ foreach (char c in invalidPathChars)
+ {
+ result = result.Replace(c.ToString(), "_");
+ }
+ return result;
+ }
+
+ string cleanContractNum = CleanFileName(getFireWork.ContractNum);
+ string cleanProjectName = CleanFileName(projectname);
+ string cleanContractName = CleanFileName(getFireWork.ContractName);
+
+ string startPath = rootPath + "File\\Word\\PHTGL\\" + cleanContractNum + "-" + cleanProjectName + "-" + cleanContractName + "-合同管理资料";
if (!Directory.Exists(startPath))
{
Directory.CreateDirectory(startPath);
}
- string zipPath = rootPath + "File\\Word\\PHTGL\\" + getFireWork.ContractNum + "-" + projectname + "-" + getFireWork.ContractName + "-合同管理资料.zip";
+ string zipPath = rootPath + "File\\Word\\PHTGL\\" + cleanContractNum + "-" + cleanProjectName + "-" + cleanContractName + "-合同管理资料.zip";
switch (getFireWork.ConfirmWay)
{
case "1":
From 808beba1fdc15942b51a2c11d1451a6d627a4ed3 Mon Sep 17 00:00:00 2001
From: fei550 <1420031550@qq.com>
Date: Mon, 22 Dec 2025 12:26:03 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=20feat:=20=E6=80=A7=E8=83=BD=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E4=B8=8E=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=BC=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 优化TestPackageData的InitTreeMenu方法,减少数据库查询次数
- InstallList页面新增数据汇总统计功能
- 修复SetSubReviewEdit2编辑时编号重复误报的bug
---
SGGL/.claude/settings.local.json | 3 +-
SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 2 +-
.../HJGL/PreDesign/InstallList.aspx | 12 ++
.../HJGL/PreDesign/InstallList.aspx.cs | 55 ++++++++
.../PreDesign/InstallList.aspx.designer.cs | 36 ++++++
.../HJGL/TestPackage/TestPackageData.aspx.cs | 120 +++++++++---------
.../SetSubReviewEdit2.aspx.cs | 23 +++-
7 files changed, 179 insertions(+), 72 deletions(-)
diff --git a/SGGL/.claude/settings.local.json b/SGGL/.claude/settings.local.json
index 5ac0ec71..c4bae7e3 100644
--- a/SGGL/.claude/settings.local.json
+++ b/SGGL/.claude/settings.local.json
@@ -10,7 +10,8 @@
"Bash(python:*)",
"Bash(cat:*)",
"Bash(pip install:*)",
- "Bash(msbuild:*)"
+ "Bash(msbuild:*)",
+ "Bash(\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe\":*)"
],
"deny": [],
"ask": []
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
index a4dfcd34..ba58f7e9 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
@@ -16838,7 +16838,7 @@
-
+
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx
index 5864550f..46f9cce2 100644
--- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx
@@ -74,6 +74,18 @@
+
+
+
+
+
+
+
+ /// 更新汇总信息
+ ///
+ 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";
+ }
}
///
diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.designer.cs
index f8aea7a7..040c21f4 100644
--- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.designer.cs
@@ -167,6 +167,42 @@ namespace FineUIPro.Web.HJGL.PreDesign
///
protected global::FineUIPro.Button btnOut;
+ ///
+ /// SummaryPanel 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel SummaryPanel;
+
+ ///
+ /// lblSummary1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Label lblSummary1;
+
+ ///
+ /// lblSummary2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Label lblSummary2;
+
+ ///
+ /// ToolbarFill3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarFill ToolbarFill3;
+
///
/// Grid1 控件。
///
diff --git a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs
index 552eaf46..a8c975b7 100644
--- a/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs
+++ b/SGGL/FineUIPro.Web/HJGL/TestPackage/TestPackageData.aspx.cs
@@ -61,83 +61,77 @@ namespace FineUIPro.Web.HJGL.TestPackage
{
this.tvControlItem.Nodes.Clear();
- TreeNode rootNode1 = new TreeNode();
- rootNode1.NodeID = "1";
- rootNode1.Text = "建筑工程";
- rootNode1.CommandName = "建筑工程";
- rootNode1.Selectable = false;
- rootNode1.EnableClickEvent = true;
+ // 创建根节点
+ TreeNode rootNode1 = new TreeNode
+ {
+ NodeID = "1",
+ Text = "建筑工程",
+ CommandName = "建筑工程",
+ Selectable = false,
+ EnableClickEvent = true
+ };
this.tvControlItem.Nodes.Add(rootNode1);
- TreeNode rootNode2 = new TreeNode();
- rootNode2.NodeID = "2";
- rootNode2.Text = "安装工程";
- rootNode2.CommandName = "安装工程";
- rootNode2.Expanded = true;
- rootNode2.EnableClickEvent = true;
+ TreeNode rootNode2 = new TreeNode
+ {
+ NodeID = "2",
+ Text = "安装工程",
+ CommandName = "安装工程",
+ Expanded = true,
+ EnableClickEvent = true
+ };
this.tvControlItem.Nodes.Add(rootNode2);
- var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
- // 获取当前用户所在单位
- var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
+ // 一次性获取所有需要的数据
+ var projectId = this.CurrUser.LoginProjectId;
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
- where x.ProjectId == this.CurrUser.LoginProjectId
- && x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
- select x).ToList();
- //List testPackageLists = (from x in Funs.DB.PTP_TestPackage
- //where x.ProjectId == this.CurrUser.LoginProjectId
- //select x).ToList();
- List unitWork1 = null;
- List unitWork2 = null;
+ where x.ProjectId == projectId
+ && x.SuperUnitWork == null
+ && x.UnitId != null
+ && x.ProjectType != null
+ select x).ToList();
- //// 当前为施工单位,只能操作本单位的数据
- //if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
- //{
- // unitWork1 = (from x in unitWorkList
- // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
- // select x).ToList();
- // unitWork2 = (from x in unitWorkList
- // where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
- // select x).ToList();
- //}
- //else
- //{
- unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
- unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
- //}
+ // 按项目类型分组,避免重复查询
+ var unitWorkGroups = unitWorkList
+ .GroupBy(x => x.ProjectType)
+ .ToDictionary(g => g.Key, g => g.ToList());
- if (unitWork1.Count() > 0)
+ // 批量获取单位名称,避免在循环中查询数据库
+ var unitIds = unitWorkList.Where(x => x.UnitId != null).Select(x => x.UnitId).Distinct().ToList();
+ var unitNameDict = new Dictionary();
+ foreach (var unitId in unitIds)
{
- foreach (var q in unitWork1)
+ var unitName = BLL.UnitService.getUnitNamesUnitIds(unitId);
+ if (!string.IsNullOrEmpty(unitName))
{
- var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
- TreeNode tn1 = new TreeNode();
- tn1.NodeID = q.UnitWorkId;
- tn1.Text = q.UnitWorkName;
- tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
- tn1.CommandName = "单位工程";
- tn1.EnableClickEvent = true;
- rootNode1.Nodes.Add(tn1);
- //var testPackageUnitList = testPackageLists.Where(x => x.UnitWorkId == q.UnitWorkId).ToList();
- //BindNodes(tn1, testPackageUnitList);
+ unitNameDict[unitId] = unitName;
}
}
- if (unitWork2.Count() > 0)
+
+ // 统一方法处理两种类型的单位工程
+ Action addUnitWorkNodes = (projectType, parentNode) =>
{
- foreach (var q in unitWork2)
+ if (unitWorkGroups.ContainsKey(projectType))
{
- var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
- TreeNode tn2 = new TreeNode();
- tn2.NodeID = q.UnitWorkId;
- tn2.Text = q.UnitWorkName;
- tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
- tn2.CommandName = "单位工程";
- tn2.EnableClickEvent = true;
- rootNode2.Nodes.Add(tn2);
- //var testPackageUnitList = testPackageLists.Where(x => x.UnitWorkId == q.UnitWorkId).ToList();
- //BindNodes(tn2, testPackageUnitList);
+ foreach (var unitWork in unitWorkGroups[projectType])
+ {
+ TreeNode treeNode = new TreeNode
+ {
+ NodeID = unitWork.UnitWorkId,
+ Text = unitWork.UnitWorkName,
+ ToolTip = unitNameDict.ContainsKey(unitWork.UnitId) ?
+ "施工单位:" + unitNameDict[unitWork.UnitId] : "施工单位:",
+ CommandName = "单位工程",
+ EnableClickEvent = true
+ };
+ parentNode.Nodes.Add(treeNode);
+ }
}
- }
+ };
+
+ // 添加建筑工程和安装工程节点
+ addUnitWorkNodes("1", rootNode1);
+ addUnitWorkNodes("2", rootNode2);
}
#endregion
diff --git a/SGGL/FineUIPro.Web/PHTGL/BiddingManagement/SetSubReviewEdit2.aspx.cs b/SGGL/FineUIPro.Web/PHTGL/BiddingManagement/SetSubReviewEdit2.aspx.cs
index 6cf33002..707a3db4 100644
--- a/SGGL/FineUIPro.Web/PHTGL/BiddingManagement/SetSubReviewEdit2.aspx.cs
+++ b/SGGL/FineUIPro.Web/PHTGL/BiddingManagement/SetSubReviewEdit2.aspx.cs
@@ -221,27 +221,36 @@ namespace FineUIPro.Web.PHTGL.BiddingManagement
return false;
}
- var IsExitCodemodel = PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewBySetSubReviewCode(this.txtSetSubReviewCode.Text.Trim().ToString());
+ // 获取当前输入的编号
+ string currentSetSubReviewCode = this.txtSetSubReviewCode.Text.Trim();
+
+ // 验证编号是否为空
+ if (string.IsNullOrEmpty(currentSetSubReviewCode))
+ {
+ ShowNotify("编号不能为空!", MessageBoxIcon.Warning);
+ return false;
+ }
+
+ // 检查编号重复性
+ var existingRecord = PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewBySetSubReviewCode(currentSetSubReviewCode);
if (string.IsNullOrEmpty(SetSubReviewID))
{
- if (IsExitCodemodel != null)
+ // 新增记录:检查编号是否已存在
+ if (existingRecord != null)
{
ShowNotify("编号已经重复,请修改!", MessageBoxIcon.Warning);
-
return false;
}
-
}
else
{
- if (IsExitCodemodel != null && IsExitCodemodel.SetSubReviewID != SetSubReviewID)
+ // 编辑记录:检查编号是否被其他记录使用
+ if (existingRecord != null && existingRecord.SetSubReviewID != SetSubReviewID)
{
ShowNotify("编号已经重复,请修改!", MessageBoxIcon.Warning);
-
return false;
}
-
}
Model.PHTGL_SetSubReview _SetSubReview = new Model.PHTGL_SetSubReview();