jianghaiqing 4 months ago
commit 04cb2f9bcc

@ -1,4 +1,9 @@
namespace DS.Module.Core.Data using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Newtonsoft.Json.Linq;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace DS.Module.Core.Data
{ {
/// <summary> /// <summary>
/// 任务模块之间用于传入、获取数据的容器 /// 任务模块之间用于传入、获取数据的容器
@ -26,6 +31,14 @@
} }
} }
public IReadOnlyCollection<string> Keys => dataContext.Keys;
public object? this[string key]
{
get { return dataContext[key]; }
set { dataContext[key] = value; }
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -52,6 +65,10 @@
{ {
return t; return t;
} }
else if (value != null)
{
return (T)Convert.ChangeType(value, typeof(T));
}
} }
return default; return default;
} }
@ -60,5 +77,7 @@
/// ///
/// </summary> /// </summary>
public bool ContainsKey(string key) => dataContext.ContainsKey(key); public bool ContainsKey(string key) => dataContext.ContainsKey(key);
} }
} }

@ -12,7 +12,7 @@ public static class StringExtensions
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
public static bool IsSqlInjection(string input) public static bool IsSqlInjection(this string input)
{ {
string[] sqlCheckList = { "TRUNCATE", "INSERT", "UPDATE", "DELETE", "DROP", "--", ";", "'" }; string[] sqlCheckList = { "TRUNCATE", "INSERT", "UPDATE", "DELETE", "DROP", "--", ";", "'" };
foreach (string item in sqlCheckList) foreach (string item in sqlCheckList)

@ -1,5 +1,5 @@
using DS.Module.Core.Data; using DS.WMS.Core.Op.Entity.TaskInteraction;
using DS.WMS.Core.Op.Entity.TaskInteraction; using SqlSugar;
namespace DS.WMS.Core.Op.Dtos.TaskInteraction namespace DS.WMS.Core.Op.Dtos.TaskInteraction
{ {
@ -8,8 +8,12 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
/// </summary> /// </summary>
public class ActionExecutionContext public class ActionExecutionContext
{ {
public BusinessTask Task { get; set; } public BusinessTask TaskInfo { get; internal set; }
public IServiceProvider ServiceProvider { get; internal set; }
public ISqlSugarClient TenantDb { get; internal set; }
public IDictionary<string, object?> AdditionalData { get; set; } = new Dictionary<string, object?>();
} }
} }

@ -1,5 +1,4 @@
using DS.Module.Core; using DS.Module.Core.Data;
using DS.Module.Core.Data;
using SqlSugar; using SqlSugar;
namespace DS.WMS.Core.Op.Entity.TaskInteraction namespace DS.WMS.Core.Op.Entity.TaskInteraction
@ -10,11 +9,11 @@ namespace DS.WMS.Core.Op.Entity.TaskInteraction
[SugarTable("business_task_mail", "任务邮件发送配置")] [SugarTable("business_task_mail", "任务邮件发送配置")]
public class BusinessTaskMail : BaseOrgModelV2<long> public class BusinessTaskMail : BaseOrgModelV2<long>
{ {
/// <summary> ///// <summary>
/// 任务类型 ///// 任务类型
/// </summary> ///// </summary>
[SugarColumn(ColumnDescription = "任务类型", IsNullable = false)] //[SugarColumn(ColumnDescription = "任务类型", IsNullable = false)]
public TaskBaseTypeEnum TaskType { get; set; } //public TaskBaseTypeEnum TaskType { get; set; }
///// <summary> ///// <summary>
///// 任务状态 ///// 任务状态
@ -22,6 +21,12 @@ namespace DS.WMS.Core.Op.Entity.TaskInteraction
//[SugarColumn(ColumnDescription = "任务状态", IsNullable = false)] //[SugarColumn(ColumnDescription = "任务状态", IsNullable = false)]
//public TaskStatusEnum TaskStatus { get; set; } = TaskStatusEnum.Complete; //public TaskStatusEnum TaskStatus { get; set; } = TaskStatusEnum.Complete;
/// <summary>
/// 配置名称
/// </summary>
[SugarColumn(ColumnDescription = "配置名称", Length = 100, IsNullable = false)]
public string Name { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 主题 /// 主题
/// </summary> /// </summary>

@ -10,7 +10,7 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <summary> /// <summary>
/// 执行特定动作 /// 执行特定动作
/// </summary> /// </summary>
/// <param name="context"></param> /// <param name="context">执行上下文</param>
/// <returns></returns> /// <returns></returns>
Task ExecuteAsync(ActionExecutionContext context); Task ExecuteAsync(ActionExecutionContext context);
} }

@ -6,7 +6,7 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <summary> /// <summary>
/// 动作执行管理 /// 动作执行管理
/// </summary> /// </summary>
public interface IActionManager public interface IActionManagerService
{ {
/// <summary> /// <summary>
/// 执行特定动作 /// 执行特定动作

@ -23,6 +23,13 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <returns></returns> /// <returns></returns>
Task<DataResult<BusinessTaskMail>> GetAsync(long id); Task<DataResult<BusinessTaskMail>> GetAsync(long id);
/// <summary>
/// 根据配置名获取
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
Task<BusinessTaskMail> GetAsync(string name);
/// <summary> /// <summary>
/// 编辑 /// 编辑
/// </summary> /// </summary>

@ -1,5 +1,6 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction;
using DS.WMS.Core.TaskPlat; using DS.WMS.Core.TaskPlat;
@ -9,14 +10,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <summary> /// <summary>
/// 动作执行管理 /// 动作执行管理
/// </summary> /// </summary>
public class ActionManager : ServiceBase, IActionManager public class ActionManagerService : ServiceBase, IActionManagerService
{ {
Dictionary<TaskActionType, IActionExecutor> ExecutorMappings; Dictionary<TaskActionType, IActionExecutor> ExecutorMappings;
/// <summary> /// <summary>
/// 初始化 /// 初始化
/// </summary> /// </summary>
public ActionManager(IServiceProvider serviceProvider) : base(serviceProvider) public ActionManagerService(IServiceProvider serviceProvider) : base(serviceProvider)
{ {
ExecutorMappings = new Dictionary<TaskActionType, IActionExecutor>(); ExecutorMappings = new Dictionary<TaskActionType, IActionExecutor>();
ExecutorMappings[TaskActionType.Mail] = new MailActionExecutor(); ExecutorMappings[TaskActionType.Mail] = new MailActionExecutor();
@ -41,13 +42,29 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
); );
TaskFlowRuner taskFlow = new(TenantDb, ServiceProvider); TaskFlowRuner taskFlow = new(TenantDb, ServiceProvider);
await taskFlow.Run(businessTask.TaskType, businessTask.BusinessId, dataContext); await taskFlow.RunWithBsno(businessTask.TaskType, businessTask.BusinessId, dataContext);
} }
public async Task ExecuteAsync(TaskFlowDataContext dataContext) public async Task ExecuteAsync(TaskFlowDataContext dataContext)
{ {
ArgumentNullException.ThrowIfNull(dataContext, nameof(dataContext)); ArgumentNullException.ThrowIfNull(dataContext, nameof(dataContext));
TaskActionType actionType = (TaskActionType)dataContext.Get<int>("ActionType");
if (ExecutorMappings.TryGetValue(actionType, out IActionExecutor executor))
{
var context = new ActionExecutionContext
{
TaskInfo = dataContext.Get<BusinessTask>(TaskFlowDataNameConst.BusinessTask),
ServiceProvider = ServiceProvider,
TenantDb = TenantDb
};
foreach (var key in dataContext.Keys)
{
context.AdditionalData[key] = dataContext[key];
}
await executor.ExecuteAsync(context);
}
} }
} }

@ -1,13 +1,43 @@
using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.Module.Core.Extensions;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using RazorEngineCore;
namespace DS.WMS.Core.Op.Method.TaskInteraction namespace DS.WMS.Core.Op.Method.TaskInteraction
{ {
/// <summary>
/// 用于邮件发送的执行器
/// </summary>
public class MailActionExecutor : IActionExecutor public class MailActionExecutor : IActionExecutor
{ {
public Task ExecuteAsync(ActionExecutionContext context) /// <summary>
/// 发送邮件
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public async Task ExecuteAsync(ActionExecutionContext context)
{ {
throw new NotImplementedException(); var service = context.ServiceProvider.GetRequiredService<ITaskMailService>();
var logService = context.ServiceProvider.GetRequiredService<ITaskLogService>();
var mailName = context.AdditionalData["MailName"] as string;
if (mailName.IsNullOrEmpty())
{
await logService.WriteLogAsync(context.TaskInfo, $"未配置【{context.TaskInfo.TaskType.GetDescription()}】任务的邮件设置");
return;
}
var mailConfig = await service.GetAsync(mailName);
if (mailConfig == null)
{
await logService.WriteLogAsync(context.TaskInfo, $"未能获取名为【{mailName}】的邮件配置");
return;
}
IRazorEngine razorEngine = new RazorEngine();
IRazorEngineCompiledTemplate titleTemplate = razorEngine.Compile(mailConfig.Title);
IRazorEngineCompiledTemplate contentTemplate = razorEngine.Compile(mailConfig.Content);
} }
} }
} }

@ -1,13 +0,0 @@
using RazorEngineCore;
namespace DS.WMS.Core.Op.Method.TaskInteraction
{
internal class MailTemplate
{
public MailTemplate()
{
IRazorEngine razorEngine = new RazorEngine();
}
}
}

@ -38,12 +38,25 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<BusinessTaskMail>> GetAsync(long id) public async Task<DataResult<BusinessTaskMail>> GetAsync(long id)
{ {
var entity = await TenantDb.Queryable<BusinessTaskMail>().Includes(x => x.Receiver).Includes(x => x.Sender) var entity = await TenantDb.Queryable<BusinessTaskMail>()
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Server).Includes(x => x.Attachments)
.Where(x => x.Id == id).FirstAsync(); .Where(x => x.Id == id).FirstAsync();
return DataResult<BusinessTaskMail>.Success(entity); return DataResult<BusinessTaskMail>.Success(entity);
} }
/// <summary>
/// 根据配置名获取
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public async Task<BusinessTaskMail> GetAsync(string name)
{
return await TenantDb.Queryable<BusinessTaskMail>()
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Server).Includes(x => x.Attachments)
.Where(x => x.Name == name).FirstAsync();
}
/// <summary> /// <summary>
/// 编辑 /// 编辑
/// </summary> /// </summary>
@ -58,12 +71,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
{ {
taskMail.Receiver ??= new(); taskMail.Receiver ??= new();
taskMail.Sender ??= new(); taskMail.Sender ??= new();
taskMail.Server ??= new();
taskMail = await TenantDb.InsertNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteReturnEntityAsync(); taskMail = await TenantDb.InsertNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Server).ExecuteReturnEntityAsync();
} }
else else
{ {
await TenantDb.UpdateNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteCommandAsync(); await TenantDb.UpdateNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Server).ExecuteCommandAsync();
} }
if (taskMail.Attachments?.Count > 0) if (taskMail.Attachments?.Count > 0)
@ -99,7 +113,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
try try
{ {
await TenantDb.DeleteNav<BusinessTaskMail>(x => model.Ids.Contains(x.Id)) await TenantDb.DeleteNav<BusinessTaskMail>(x => model.Ids.Contains(x.Id))
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Attachments).ExecuteCommandAsync(); .Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Server).Include(x => x.Attachments)
.ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();
return DataResult.Success; return DataResult.Success;

@ -47,6 +47,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// </summary> /// </summary>
protected Lazy<IClientFlowInstanceService> FlowService { get; private set; } protected Lazy<IClientFlowInstanceService> FlowService { get; private set; }
/// <summary>
/// 工作流服务
/// </summary>
protected Lazy<IActionManagerService> ActionService { get; private set; }
/// <summary> /// <summary>
/// 初始化 /// 初始化
/// </summary> /// </summary>
@ -56,6 +61,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
ManagerService = provider.GetRequiredService<ITaskManageService>(); ManagerService = provider.GetRequiredService<ITaskManageService>();
LogService = provider.GetRequiredService<ITaskLogService>(); LogService = provider.GetRequiredService<ITaskLogService>();
FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>()); FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
ActionService = new Lazy<IActionManagerService>(provider.GetRequiredService<IActionManagerService>());
} }
/// <summary> /// <summary>
@ -462,6 +468,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (useTransaction) if (useTransaction)
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();
ActionService.Value.TriggerAction(task);
return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? GetNextType(task) : null); return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? GetNextType(task) : null);
} }
catch (Exception ex) catch (Exception ex)
@ -622,7 +629,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
} }
var allocation = allocations.Find(x => x.CarrierId == carrierId); var allocation = allocations.Find(x => x.CarrierId == carrierId);
//未找到匹配值 //首先使用船公司匹配
if (allocation == null)
allocation = allocations.Find(x => x.CarrierId == null); //使用默认值匹配
if (allocation == null) if (allocation == null)
return null; return null;
@ -631,15 +641,15 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
{ {
expr = expr.Or(x => x.IsCustomerService); expr = expr.Or(x => x.IsCustomerService);
} }
else if (allocation.IsAllotOperator) if (allocation.IsAllotOperator)
{ {
expr = expr.Or(x => x.IsOperator); expr = expr.Or(x => x.IsOperator);
} }
else if (allocation.IsAllotSale) if (allocation.IsAllotSale)
{ {
expr = expr.Or(x => x.IsSale); expr = expr.Or(x => x.IsSale);
} }
else if (allocation.IsAllotVouchingClerk) if (allocation.IsAllotVouchingClerk)
{ {
expr = expr.Or(x => x.IsVouchingClerk); expr = expr.Or(x => x.IsVouchingClerk);
} }

@ -46,7 +46,7 @@ namespace DS.WMS.Core.Sys.Interface
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
public DataResult EditSysPrintTemplate(SysPrintTemplateReq req); public Task<DataResult> EditSysPrintTemplate(SysPrintTemplateReq req);
/// <summary> /// <summary>
/// 打印模块删除 /// 打印模块删除

@ -12,6 +12,7 @@ using DS.Module.SqlSugar;
using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Code.Entity;
using Org.BouncyCastle.Ocsp; using Org.BouncyCastle.Ocsp;
using System.Collections.Generic; using System.Collections.Generic;
using Masuit.Tools.Strings;
namespace DS.WMS.Core.Sys.Method namespace DS.WMS.Core.Sys.Method
{ {
@ -96,29 +97,71 @@ namespace DS.WMS.Core.Sys.Method
.First(); .First();
return DataResult<SysPrintTemplateRes>.Success(data, MultiLanguageConst.DataQuerySuccess); return DataResult<SysPrintTemplateRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
} }
public DataResult EditSysPrintTemplate(SysPrintTemplateReq req)
public async Task<DataResult> EditSysPrintTemplate(SysPrintTemplateReq req)
{ {
if (req.Id == 0) if (req.Id == 0)
{ {
var isExist = db.Queryable<SysPrintTemplate>().Where(x => x.TemplateCode == req.TemplateCode).WhereIF(req.CarrierId != 0, x => x.CarrierId == req.CarrierId).First(); if (db.Queryable<SysPrintTemplate>().Where(x => x.TemplateCode == req.TemplateCode).WhereIF(req.CarrierId != 0, x => x.CarrierId == req.CarrierId).Any())
if (isExist != null)
{ {
return DataResult.Failed("打印模板唯一编码已存在!"); return await Task.FromResult(DataResult.Failed("打印模板唯一编码已存在!"));
}
if (req.IsUseDataSource) {
if (string.IsNullOrEmpty(req.SourceSql))
{
return await Task.FromResult(DataResult.Failed("打印数据源不能为空!"));
}
if (!req.SourceSql.Contains(';'))
{
return await Task.FromResult(DataResult.Failed("数据源必须包含分号!"));
}
if (req.SourceSql.Substring(req.SourceSql.Length - 1, 1) != ";")
{
return await Task.FromResult(DataResult.Failed("数据源最后必须包含分号!"));
}
if (req.SourceSql.IsSqlInjection())
{
return await Task.FromResult(DataResult.Failed("sql数据源包含非法字符,请检查!"));
}
} }
var data = req.Adapt<SysPrintTemplate>(); var data = req.Adapt<SysPrintTemplate>();
var entity = db.Insertable(data).ExecuteReturnEntity(); var entity = await db.Insertable(data).ExecuteReturnEntityAsync();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
} }
else else
{ {
var info = db.Queryable<SysPrintTemplate>().Where(x => x.Id == req.Id).First(); var info = await db.Queryable<SysPrintTemplate>().Where(x => x.Id == req.Id).FirstAsync();
if (req.IsUseDataSource)
{
if (string.IsNullOrEmpty(req.SourceSql))
{
return await Task.FromResult(DataResult.Failed("打印数据源不能为空!"));
}
if (!req.SourceSql.Contains(';'))
{
return await Task.FromResult(DataResult.Failed("数据源必须包含分号!"));
}
if (req.SourceSql.Substring(req.SourceSql.Length - 1, 1) != ";")
{
return await Task.FromResult(DataResult.Failed("数据源最后必须包含分号!"));
}
if (req.SourceSql.IsSqlInjection())
{
return await Task.FromResult(DataResult.Failed("sql数据源包含非法字符,请检查!"));
}
}
info = req.Adapt(info); info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); await db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
} }
} }

@ -325,12 +325,22 @@ namespace DS.WMS.Core.TaskPlat
} }
catch (Exception ex) catch (Exception ex)
{ {
string exMessage;
if (ex is TargetInvocationException ex2 && ex2.InnerException != null)
{
exMessage = WriteLog("模块内部执行过程中发生异常", ex2.InnerException);
}
else
{
exMessage = WriteLog("模块外部调用过程中发生异常", ex);
}
flowLogDetail.ExceptionMessage = exMessage;
flowLog.IsComplete = false; flowLog.IsComplete = false;
flowLog.IsSuccess = false; flowLog.IsSuccess = false;
flowLogDetail.IsComplete = false; flowLogDetail.IsComplete = false;
flowLogDetail.IsSuccess = false; flowLogDetail.IsSuccess = false;
flowLogDetail.ExceptionMessage = WriteLog("模块执行过程中发生异常", ex);
await tenantDb.Insertable(flowLogDetail).ExecuteCommandAsync(); await tenantDb.Insertable(flowLogDetail).ExecuteCommandAsync();
if (executeConfig.IsExceptionContinue) if (executeConfig.IsExceptionContinue)

@ -94,9 +94,9 @@ public class PrintTemplateController : ApiController
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("EditSysPrintTemplate")] [Route("EditSysPrintTemplate")]
public DataResult EditSysPrintTemplate([FromBody] SysPrintTemplateReq req) public async Task<DataResult> EditSysPrintTemplate([FromBody] SysPrintTemplateReq req)
{ {
var res = _invokeService.EditSysPrintTemplate(req); var res = await _invokeService.EditSysPrintTemplate(req);
return res; return res;
} }

@ -313,7 +313,6 @@ namespace DS.WMS.PrintApi.Service
var printFile = Path.Combine(savePath, printFileName); var printFile = Path.Combine(savePath, printFileName);
//写入CRX文件 //写入CRX文件
using (FileStream fs = new FileStream(printFile, FileMode.Create)) using (FileStream fs = new FileStream(printFile, FileMode.Create))
{ {
@ -324,7 +323,6 @@ namespace DS.WMS.PrintApi.Service
//生成报表 //生成报表
FastReport.Report report = new FastReport.Report(); FastReport.Report report = new FastReport.Report();
report.Load(printFile); report.Load(printFile);
var str = new FastReport.Data.JsonConnection.JsonDataSourceConnectionStringBuilder(); var str = new FastReport.Data.JsonConnection.JsonDataSourceConnectionStringBuilder();
str.Json = JsonConvert.SerializeObject(data); str.Json = JsonConvert.SerializeObject(data);
if (report.Dictionary.Connections.Count == 0) if (report.Dictionary.Connections.Count == 0)
@ -336,33 +334,8 @@ namespace DS.WMS.PrintApi.Service
Name = "Connection", Name = "Connection",
}); });
} }
//else {
// var dataSource = report.Dictionary.Connections[0] as JsonDataSourceConnection; report.Save(printFile);
// dataSource.ConnectionString = str.ConnectionString;
//}
//var dataSource = report.Dictionary.Connections[0] as JsonDataSourceConnection;
//var str = new FastReport.Data.JsonConnection.JsonDataSourceConnectionStringBuilder();
//str.Json = JsonConvert.SerializeObject(data);
//dataSource.ConnectionString = str.ConnectionString;
//JsonSchemaGenerator generator = new JsonSchemaGenerator();
//JsonSchema jsonSchema = generator.Generate()
//report.Dictionary.Connections.Clear();
//var dataSource = report.Dictionary.Connections[0] as JsonDataSourceConnection;
//var str = new FastReport.Data.JsonConnection.JsonDataSourceConnectionStringBuilder();
//str.Json = JsonConvert.SerializeObject(data);
////dataSource.ConnectionString = str.ConnectionString;
////重置数据源
//report.Dictionary.Connections.Add(new JsonDataSourceConnection()
//{
// ConnectionString = str.ConnectionString,
// Alias = "JSON"
//});
//report.Dictionary.Connections[0].ConnectionString = str.ConnectionString;
report.Prepare(); report.Prepare();
var printName = string.Empty; var printName = string.Empty;

Loading…
Cancel
Save