cnf
2025-05-12 96b22db20a74963e39e490e94bf969cc60ef1b04
StandardInterface/MESApplication/Controllers/PLM/PLMController.cs
@@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Mvc;
using System.Dynamic;
using System.IO;
using System.Net.Http.Headers;
namespace MESApplication.Controllers.PLM;
@@ -122,4 +123,33 @@
            });
        }
    }
    //MP-O型圈-83070100066样品1-83070100068样品2.pdf
    //e18f53b6-6615-8140-11ee-423d1dd32487
    //RetrieveDrawings  调取图纸 get方式
    [HttpGet("OpenDrawingsGet")]
    public IActionResult OpenDrawingsGet(string fileId, string fName)
    {
        try
        {
            var resultInfos = wdd.SendRequest("Download", fileId);
            // 添加Content-Disposition响应头
            var cd = new ContentDispositionHeaderValue("attachment");
            cd.FileNameStar = fName; // 自动处理编码
            Response.Headers.Add("Content-Disposition", cd.ToString());
            return File(resultInfos, "application/octet-stream", fName);
        }
        catch (Exception ex)
        {
            return StatusCode(500, new ResponseResult
            {
                status = 1,
                message = ex.Message,
                data = null
            });
        }
    }
}