diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 85061836..e6fa3930 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -4822,7 +4822,7 @@
打印
订舱Id
- 打印模板类型,根据字典传值
+ 类型,1:pdf、2:xlsx
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index 2f78f05b..0892c817 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -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
/// 打印
///
/// 订舱Id
- /// 打印模板类型,根据字典传值
+ /// 类型,1:pdf、2:xlsx
///
[HttpGet("/BookingOrder/Print")]
- public async Task Print(long bookingId, string type)
+ public async Task 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().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;
+ }
+ ///
+ /// 下载打印文件
+ ///
+ /// 文件名
+ ///
+ [HttpGet("/BookingOrder/downloadPrint")]
+ public IActionResult DownloadPrint(string fileName)
+ {
+ var opt = App.GetOptions().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 下货纸