fix(print): 避免 FastReport 模板重复写入
仅在报表连接串与系统连接串不一致时才更新并保存模板, 同时增加模板文件存在性校验,减少打印时因模板文件异常导致的报错。 2.修复无损检测委托单生成逻辑
This commit is contained in:
parent
ecd2d00ef7
commit
453d1d5a3b
File diff suppressed because it is too large
Load Diff
|
|
@ -38,6 +38,10 @@ namespace FineUIPro.Web.Controls
|
||||||
{
|
{
|
||||||
ReportPath = Request.Params["ReportPath"];
|
ReportPath = Request.Params["ReportPath"];
|
||||||
WebReport1.StartReport += WebReport1_StartReport;
|
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)
|
if (dataTables != null && dataTables.Count > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dataTables.Count; i++)
|
for (int i = 0; i < dataTables.Count; i++)
|
||||||
|
|
@ -49,8 +53,12 @@ namespace FineUIPro.Web.Controls
|
||||||
WebReport1.Report.Load(ReportPath);
|
WebReport1.Report.Load(ReportPath);
|
||||||
if (WebReport1.Report.Dictionary.Connections.Count > 0)
|
if (WebReport1.Report.Dictionary.Connections.Count > 0)
|
||||||
{
|
{
|
||||||
WebReport1.Report.Dictionary.Connections[0].ConnectionString = Funs.ConnString;
|
var reportConnection = WebReport1.Report.Dictionary.Connections[0];
|
||||||
WebReport1.Report.Save(ReportPath);
|
if (reportConnection.ConnectionString != Funs.ConnString)
|
||||||
|
{
|
||||||
|
reportConnection.ConnectionString = Funs.ConnString;
|
||||||
|
WebReport1.Report.Save(ReportPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
WebReport1.ReportFile = ReportPath;
|
WebReport1.ReportFile = ReportPath;
|
||||||
WebReport1.Prepare();
|
WebReport1.Prepare();
|
||||||
|
|
@ -69,4 +77,4 @@ namespace FineUIPro.Web.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue