|
|
|
@ -28,7 +28,17 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
public static class PrintHelper
|
|
|
|
|
{
|
|
|
|
|
public static async Task<byte[]> GeneratePrintFile(string BusiJson,string reportUrl, PrintFileTypeEnum printFileType,
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生成打印文件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="busiJson">业务详情JSON</param>
|
|
|
|
|
/// <param name="reportUrl">请求生成URL</param>
|
|
|
|
|
/// <param name="dataSourceKey">数据源Key</param>
|
|
|
|
|
/// <param name="printFileType">文档类型</param>
|
|
|
|
|
/// <param name="printTemplate">文档模板</param>
|
|
|
|
|
/// <returns>返回文件二进制</returns>
|
|
|
|
|
public static async Task<byte[]> GeneratePrintFile(string busiJson,string reportUrl, string dataSourceKey,
|
|
|
|
|
PrintFileTypeEnum printFileType,
|
|
|
|
|
BookingPrintTemplate printTemplate)
|
|
|
|
|
{
|
|
|
|
|
var logger = Log.CreateLogger(nameof(PrintHelper));
|
|
|
|
@ -77,10 +87,11 @@ namespace Myshipping.Application
|
|
|
|
|
file.Close();
|
|
|
|
|
|
|
|
|
|
NameValueCollection par = new NameValueCollection();
|
|
|
|
|
par.Add("printType", ((int)printFileType).ToString());
|
|
|
|
|
par.Add("dataJson", BusiJson);
|
|
|
|
|
par.Add("printType", printFileType.ToString().ToLower());
|
|
|
|
|
par.Add($"dataJson{dataSourceKey}", busiJson);
|
|
|
|
|
|
|
|
|
|
var rtn = TransmitFile(reportUrl, par, new {
|
|
|
|
|
var genUrl = $"{reportUrl}Report/PrintReport";
|
|
|
|
|
var rtn = TransmitFile(genUrl, par, new {
|
|
|
|
|
file = "file",
|
|
|
|
|
fileName = printTemplate.FileName,
|
|
|
|
|
fileBytes = heByte
|
|
|
|
|