|
|
|
@ -14,6 +14,7 @@ using System.Collections.Generic;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using DS.WMS.PrintApi.Middleware;
|
|
|
|
|
using Newtonsoft.Json.Schema;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.PrintApi.Service
|
|
|
|
|
{
|
|
|
|
@ -322,18 +323,42 @@ namespace DS.WMS.PrintApi.Service
|
|
|
|
|
FastReport.Report report = new FastReport.Report();
|
|
|
|
|
report.Load(printFile);
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
if (report.Dictionary.Connections.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
ConnectionString = str.ConnectionString,
|
|
|
|
|
Alias = "JSON"
|
|
|
|
|
});
|
|
|
|
|
//重置数据源
|
|
|
|
|
report.Dictionary.Connections.Add(new JsonDataSourceConnection()
|
|
|
|
|
{
|
|
|
|
|
ConnectionString = str.ConnectionString,
|
|
|
|
|
Name = "Connection",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var dataSource = report.Dictionary.Connections[0] as JsonDataSourceConnection;
|
|
|
|
|
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();
|
|
|
|
|