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