打印文件名

optimize
wanghaomei 2 years ago
parent e769b4815d
commit 5195bbf4b1

@ -1684,6 +1684,12 @@ namespace Myshipping.Application
throw Oops.Bah(BookingErrorCode.BOOK115);
}
var order = await _rep.FirstOrDefaultAsync(x => x.Id == bookingId);
if (order == null)
{
throw Oops.Bah(BookingErrorCode.BOOK001);
}
var fileName = string.Empty;
#region FastReport打印
@ -1708,7 +1714,13 @@ namespace Myshipping.Application
throw Oops.Bah("类型参数不正确");
}
fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}{fileType}", Encoding.GetEncoding("UTF-8"));//名称
var dicCate = (await _cache.GetAllDictData()).FirstOrDefault(x => x.Code == cateCode && x.TypeCode == "booking_template_category");
if (dicCate == null)
{
throw Oops.Bah("分类代码参数不正确");
}
fileName = HttpUtility.UrlEncode($"{dicCate.Value}_{order.MBLNO}_{DateTime.Now.Ticks}{fileType}", Encoding.GetEncoding("UTF-8"));//名称
var opt = App.GetOptions<TempFileOptions>().Path;
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
if (!Directory.Exists(serverpath))
@ -1735,7 +1747,6 @@ namespace Myshipping.Application
var result = new FileStream(fileAbsPath, FileMode.Open);
var excelwork = new HSSFWorkbook(result);
var sheet = excelwork.GetSheetAt(0);
var order = await _rep.AsQueryable().Where(x => x.Id == bookingId).FirstAsync();
var entity = await _excelrep.AsQueryable().Where(x => x.PId == templateId).OrderBy(x => x.Row).ToListAsync();
//单元格样式
var cellStyle = NpoiExcelExportHelper._.CreateStyle(excelwork, HorizontalAlignment.Center, VerticalAlignment.Center, 10, true, 0);

Loading…
Cancel
Save