工单导入模板下载

This commit is contained in:
quowingwang
2025-12-18 16:32:28 +08:00
parent 82e4d55664
commit 019e11b1c8
4 changed files with 15 additions and 15 deletions

View File

@@ -54,21 +54,21 @@ namespace ZR.Admin.WebApi.Controllers
/// <param name="path">完整文件路径</param>
/// <param name="fileName">带扩展文件名</param>
/// <returns></returns>
//protected IActionResult ExportExcel(string path, string fileName)
//{
// //var webHostEnvironment = App.WebHostEnvironment;
// if (!Path.Exists(path))
// {
// throw new CustomException(fileName + "文件不存在");
// }
// var stream = Io.File.OpenRead(path); //创建文件流
// Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
// return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName));
// // return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileName);
//}
protected IActionResult ExportExcel(string path, string fileName)
{
//var webHostEnvironment = App.WebHostEnvironment;
if (!Path.Exists(path))
{
throw new CustomException(fileName + "文件不存在");
}
var stream = Io.File.OpenRead(path); //创建文件流
Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", HttpUtility.UrlEncode(fileName));
// return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileName);
}
protected IActionResult ExportExcel2(string path, string fileName)
{
if (!Path.Exists(path))
{

View File

@@ -59,7 +59,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
public IActionResult ImportTemplateExcel()
{
(string, string) result = DownloadImportTemplate("日生产计划模板");//返回文件名和路径
return ExportExcel2(result.Item2, result.Item1);
return ExportExcel(result.Item2, result.Item1);
}