打印文件下载

booking_auth_dev
wet 2 years ago
parent 83e42e662e
commit 0c5e4adbbb

@ -4822,7 +4822,7 @@
打印
</summary>
<param name="bookingId">订舱Id</param>
<param name="type">打印模板类型,根据字典传值</param>
<param name="type">类型1pdf、2xlsx</param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingOrderService.SendXHZ(System.Int64)">

@ -478,7 +478,9 @@ namespace Myshipping.Application
currEdiExtEntity.Id = ediExtEntity.Id;
currEdiExtEntity.BookingId = ediExtEntity.BookingId;
await _bookingEDIExt.AsUpdateable(currEdiExtEntity).IgnoreColumns(it => new { it.BookingId
await _bookingEDIExt.AsUpdateable(currEdiExtEntity).IgnoreColumns(it => new
{
it.BookingId
}).ExecuteCommandAsync();
}
}
@ -1209,17 +1211,40 @@ namespace Myshipping.Application
/// 打印
/// </summary>
/// <param name="bookingId">订舱Id</param>
/// <param name="type">打印模板类型,根据字典传值</param>
/// <param name="type">类型1pdf、2xlsx</param>
/// <returns></returns>
[HttpGet("/BookingOrder/Print")]
public async Task<IActionResult> Print(long bookingId, string type)
public async Task<string> Print(long bookingId, string type)
{
var bs = await GetReportFile(bookingId, type);
var fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.pdf", Encoding.GetEncoding("UTF-8"));
var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
var fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.pdf", Encoding.GetEncoding("UTF-8"));////名称
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
var opt = App.GetOptions<TempFileOptions>().Path;
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
if (bs != null)
{
using (System.IO.MemoryStream men = new MemoryStream(bs))
{
System.Drawing.Bitmap bmp = System.Drawing.Bitmap.FromStream(men) as System.Drawing.Bitmap;
bmp.Save(serverpath);
}
}
return fileName;
}
/// <summary>
/// 下载打印文件
/// </summary>
/// <param name="fileName">文件名</param>
/// <returns></returns>
[HttpGet("/BookingOrder/downloadPrint")]
public IActionResult DownloadPrint(string fileName)
{
var opt = App.GetOptions<TempFileOptions>().Path;
var fileFullPath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
var result = new FileStreamResult(new FileStream(fileFullPath + fileName, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
return result;
}
#endregion
#region 下货纸

Loading…
Cancel
Save