Skip to content

Commit

Permalink
修复首次启动程序,创建例子报表组出错
Browse files Browse the repository at this point in the history
  • Loading branch information
NoneDay committed Sep 21, 2024
1 parent 058aeae commit 5bbbf4d
Show file tree
Hide file tree
Showing 21 changed files with 5,840 additions and 198 deletions.
Binary file modified end/CellReport.dll
Binary file not shown.
11 changes: 6 additions & 5 deletions end/reportWeb/Controllers/DesignController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public async Task<IActionResult> Preview(String _content, String _ConnectionId,
reportName = reportName.Split(":")[1];
using var reportDefine = await XmlReport.loadReportFromXmlDoc(xmlDoc, this.rpt_group.report_path, reportName ?? "temp.cr");
using var report_env = reportDefine.getEnv();
report_env.rpt_group_name = rpt_group.name;
report_env.report_name = "0预览" + Guid.NewGuid().ToString("N");
if (!String.IsNullOrEmpty(_fresh_ds))
{
report_env.getExprFaced().addVariable("_fresh_ds", _fresh_ds);
Expand Down Expand Up @@ -201,8 +203,7 @@ public async Task<IActionResult> Preview(String _content, String _ConnectionId,
Engine engine = new Engine(reportDefine);
long end = DateTime.Now.Ticks;
report_env.logger.Debug($"分析xml耗时:{(DateTime.Now.Ticks - start) / 10000000.0}");
report_env.rpt_group_name = rpt_group.name;
report_env.report_name = "设计报表预览"+Guid.NewGuid().ToString("N");
report_env.report_name = "1预览" + Guid.NewGuid().ToString("N");
Exception cur_exception = null;
Func<Task> my_out_act = async () =>
{
Expand Down Expand Up @@ -349,7 +350,7 @@ public async Task<IActionResult> exec_expr(String expr, String report_content)
{
exprFaced = new ExprFaced2();
exprFaced.addNewScopeForScript();
report_env = new Env();
report_env = new Env("exec_expr1");
cur_GroupMap = new();
exprFaced.addVariable("env", report_env);
exprFaced.addVariable("__env__", report_env);
Expand Down Expand Up @@ -502,7 +503,7 @@ public async Task<IActionResult> Open(String reportName, string zb_dict_str, str
if (file_path.StartsWith(this.rpt_group.report_path)
&& System.IO.File.Exists(file_path))
{
using Env parent_env = new Env();
using Env parent_env = new Env("open");
await XmlReport.templateValue2Env(this.rpt_group.report_path, reportName, parent_env);
var xmlDoc = (await XmlReport.getReportXmlDoc(this.rpt_group.report_path, reportName, isDesign: true)).xml;
//var ret = XmlReport.reportToXmlDocumnt(XmlReport.loadReport(file_path), false).OuterXml;
Expand Down Expand Up @@ -716,7 +717,7 @@ public async Task<IActionResult> open_template(String path)
else
path = path + "/template.xml";
var file_path = Path.Combine(this.rpt_group.report_path, path);
using Env parent_env = new Env();
using Env parent_env = new Env("open_template");
await XmlReport.templateValue2Env(this.rpt_group.report_path, path, parent_env, true);

if (file_path.StartsWith(this.rpt_group.report_path) && System.IO.File.Exists(file_path))
Expand Down
15 changes: 8 additions & 7 deletions end/reportWeb/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public IActionResult test_login(String login_script, string test_user, string te

var ef = new CellReport.core.expr.ExprFaced2();
ef.addNewScopeForScript();
using var report_env = new Env();
using var report_env = new Env("test_login");
report_env.logger = logger;
ef.addVariable("env", report_env);
ef.addVariable("__env__", report_env);
Expand Down Expand Up @@ -119,7 +119,7 @@ public IActionResult index()
[AllowAnonymous]
public IActionResult login([FromBody] UserInfo userinfo)
{
using var cur_env=new CellReport.running.Env();
using var cur_env = new CellReport.running.Env("login1");
var verfiy_code_script = cur_env.TemplateGet("verfiy_code_script");
CR_Object result = new CR_Object() { { "errcode", 1 }, { "message", "用户名或密码错误" } };
var verfiy_code = HttpContext.Session.GetString("verfiy_code");
Expand Down Expand Up @@ -159,7 +159,7 @@ public IActionResult login([FromBody] UserInfo userinfo)
{
var ef = new CellReport.core.expr.ExprFaced2();
ef.addNewScopeForScript();
using var report_env = new Env();
using var report_env = new Env("login2");
ef.addVariable("env", report_env);
ef.addVariable("__env__", report_env);
ef.addVariable("userid", username);
Expand Down Expand Up @@ -393,7 +393,7 @@ public static UserInfo ValidateJwtToken(HttpContext HttpContext, string raw_toke
[AllowAnonymous]
public IActionResult VerifyCode(string userid, int code_len)
{
using var cur_env = new CellReport.running.Env();
using var cur_env = new CellReport.running.Env("VerifyCode1");
var verfiy_code_script = cur_env.TemplateGet("verfiy_code_script");
if (string.IsNullOrWhiteSpace(verfiy_code_script))
verfiy_code_script = configuration["verfiy_code_script"];
Expand All @@ -413,7 +413,7 @@ public IActionResult VerifyCode(string userid, int code_len)
HttpContext.Session.SetString("send_time", DateTime.Now.Ticks.ToString());
var ef = new CellReport.core.expr.ExprFaced2();
ef.addNewScopeForScript();
using var report_env = new Env();
using var report_env = new Env("VerifyCode2");
report_env.logger = logger;
ef.addVariable("env", report_env);
ef.addVariable("__env__", report_env);
Expand All @@ -437,16 +437,17 @@ public IActionResult rpt_montior()
return new JsonResult(new
{
errcode = 0,
running = new List<Object[]> { new Object[] { "rpt_group_name", "report_name", "calc_type", "report_param", "start", "end", "datasource_name", "sql", "ds_name", "sql_start", "sql_end", "datasource_stat", "info" } }.Concat(
running = new List<Object[]> { new Object[] { "env_name","rpt_group_name", "report_name", "calc_type", "report_param", "start", "end", "datasource_name", "sql", "ds_name", "sql_start", "sql_end", "datasource_stat", "info" } }.Concat(
reportWeb.other.ReportMonitor.Instance.running.Values.SelectMany(rpt_info => rpt_info.DataSourceInfoBag, (rpt_info, datasource_info) => {
return new Object[]
{
rpt_info.env_name,
rpt_info.rpt_group_name,
rpt_info.report_name,
rpt_info.calc_type,
rpt_info.report_param,
rpt_info.start,
rpt_info.end,
rpt_info.end,
datasource_info.datasource_name,
datasource_info.sql,
datasource_info.ds_name,
Expand Down
11 changes: 10 additions & 1 deletion end/reportWeb/Pages/ReportDefineForWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ internal ReportDefine ensureReportDefine()
{
//var load_task=;
//load_task.ConfigureAwait(continueOnCapturedContext:false);
reportDefine = XmlReport.loadReport(gobal_reportDefinePath, reportName).Result;
try
{
reportDefine = XmlReport.loadReport(gobal_reportDefinePath, reportName).Result;
}
catch (Exception e)
{
logger.Error("----XmlReport.loadReport-----");
logger.Error(e);
throw;
}
}
reportDefine.getEnv().logger = logger;
//reportDefinePath = gobal_reportDefinePath + reportName;
Expand Down
Loading

0 comments on commit 5bbbf4d

Please sign in to comment.