|
|
|
@ -1211,25 +1211,20 @@ namespace Myshipping.Application
|
|
|
|
|
/// 打印
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId">订舱Id</param>
|
|
|
|
|
/// <param name="type">类型,1:pdf、2:xlsx</param>
|
|
|
|
|
/// <param name="typeCode">打印类型代码,对应字典booking_template_type</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[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 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);
|
|
|
|
|
}
|
|
|
|
|
if (!Directory.Exists(serverpath)) {
|
|
|
|
|
Directory.CreateDirectory(serverpath);
|
|
|
|
|
}
|
|
|
|
|
await File.WriteAllBytesAsync(Path.Combine(serverpath, fileName),bs);
|
|
|
|
|
return fileName;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|