fix(print): 避免 FastReport 模板重复写入

仅在报表连接串与系统连接串不一致时才更新并保存模板,
同时增加模板文件存在性校验,减少打印时因模板文件异常导致的报错。
2.修复无损检测委托单生成逻辑
This commit is contained in:
李鹏飞 2026-04-21 19:37:20 +08:00
parent ecd2d00ef7
commit 453d1d5a3b
2 changed files with 1306 additions and 1298 deletions

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,10 @@ namespace FineUIPro.Web.Controls
{
ReportPath = Request.Params["ReportPath"];
WebReport1.StartReport += WebReport1_StartReport;
if (string.IsNullOrEmpty(ReportPath) || !System.IO.File.Exists(ReportPath))
{
throw new System.IO.FileNotFoundException("打印模板不存在!", ReportPath);
}
if (dataTables != null && dataTables.Count > 0)
{
for (int i = 0; i < dataTables.Count; i++)
@ -49,8 +53,12 @@ namespace FineUIPro.Web.Controls
WebReport1.Report.Load(ReportPath);
if (WebReport1.Report.Dictionary.Connections.Count > 0)
{
WebReport1.Report.Dictionary.Connections[0].ConnectionString = Funs.ConnString;
WebReport1.Report.Save(ReportPath);
var reportConnection = WebReport1.Report.Dictionary.Connections[0];
if (reportConnection.ConnectionString != Funs.ConnString)
{
reportConnection.ConnectionString = Funs.ConnString;
WebReport1.Report.Save(ReportPath);
}
}
WebReport1.ReportFile = ReportPath;
WebReport1.Prepare();
@ -69,4 +77,4 @@ namespace FineUIPro.Web.Controls
}
}
}
}
}