生产工单

This commit is contained in:
quowingwang
2025-12-20 10:51:20 +08:00
parent 3e7c2d959b
commit ee2d16f27b
5 changed files with 16 additions and 16 deletions

View File

@@ -54,21 +54,21 @@ namespace ZR.Admin.WebApi.Controllers
/// <param name="path">完整文件路径</param> /// <param name="path">完整文件路径</param>
/// <param name="fileName">带扩展文件名</param> /// <param name="fileName">带扩展文件名</param>
/// <returns></returns> /// <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) 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)) if (!Path.Exists(path))
{ {

View File

@@ -59,7 +59,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
public IActionResult ImportTemplateExcel() public IActionResult ImportTemplateExcel()
{ {
(string, string) result = DownloadImportTemplate("日生产计划模板");//返回文件名和路径 (string, string) result = DownloadImportTemplate("日生产计划模板");//返回文件名和路径
return ExportExcel(result.Item2, result.Item1); return ExportExcel2(result.Item2, result.Item1);
} }
@@ -145,7 +145,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
if (item.PreviousNumber != null && item.PreviousNumber > 0 && item.PQualifiedNum != null && item.PQualifiedNum > 0) if (item.PreviousNumber != null && item.PreviousNumber > 0 && item.PQualifiedNum != null && item.PQualifiedNum > 0)
{ {
decimal rate = (decimal)item.PQualifiedNum / (decimal)item.PreviousNumber; decimal rate = (decimal)item.PQualifiedNum / (decimal)item.PreviousNumber;
item.PQualifiedRate = Math.Round(rate, 2); item.PQualifiedRate = Math.Round(rate, 4);
} }
else else
{ {