|
|
@ -1211,25 +1211,20 @@ namespace Myshipping.Application
|
|
|
|
/// 打印
|
|
|
|
/// 打印
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="bookingId">订舱Id</param>
|
|
|
|
/// <param name="bookingId">订舱Id</param>
|
|
|
|
/// <param name="type">类型,1:pdf、2:xlsx</param>
|
|
|
|
/// <param name="typeCode">打印类型代码,对应字典booking_template_type</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("/BookingOrder/Print")]
|
|
|
|
[HttpGet("/BookingOrder/Print")]
|
|
|
|
public async Task<string> Print(long bookingId, string type)
|
|
|
|
public async Task<string> Print(long bookingId, string typeCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var bs = await GetReportFile(bookingId, type);
|
|
|
|
var bs = await GetReportFile(bookingId, typeCode);
|
|
|
|
var fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.pdf", Encoding.GetEncoding("UTF-8"));////名称
|
|
|
|
var fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.pdf", Encoding.GetEncoding("UTF-8"));////名称
|
|
|
|
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
|
|
|
|
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
|
|
|
|
|
|
|
|
if (!Directory.Exists(serverpath)) {
|
|
|
|
if (bs != null)
|
|
|
|
Directory.CreateDirectory(serverpath);
|
|
|
|
{
|
|
|
|
|
|
|
|
using (System.IO.MemoryStream men = new MemoryStream(bs))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
System.Drawing.Bitmap bmp = System.Drawing.Bitmap.FromStream(men) as System.Drawing.Bitmap;
|
|
|
|
|
|
|
|
bmp.Save(serverpath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
await File.WriteAllBytesAsync(Path.Combine(serverpath, fileName),bs);
|
|
|
|
return fileName;
|
|
|
|
return fileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|