From a376d24964db749ed38a5873d2e6aaa1b82b2e83 Mon Sep 17 00:00:00 2001
From: sjz <1240968267@qq.com>
Date: 星期四, 13 二月 2025 18:04:41 +0800
Subject: [PATCH] 调取plm接口 返回文件流给前端

---
 MESApplication/Controllers/PLM/PLMController.cs |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/MESApplication/Controllers/PLM/PLMController.cs b/MESApplication/Controllers/PLM/PLMController.cs
index 102d88b..52846e6 100644
--- a/MESApplication/Controllers/PLM/PLMController.cs
+++ b/MESApplication/Controllers/PLM/PLMController.cs
@@ -1,7 +1,9 @@
-锘縰sing MES.Service.service.PLM;
+锘縰sing ConsoleApp1;
+using MES.Service.service.PLM;
 using MES.Service.util;
 using Microsoft.AspNetCore.Mvc;
 using System.Dynamic;
+using System.IO;
 
 namespace MESApplication.Controllers.PLM;
 
@@ -11,6 +13,7 @@
 public class PLMController : ControllerBase
 {
     private readonly PLMManager m = new();
+    private readonly WarehouseDownloadDoc wdd = new();
 
     //RetrieveDrawings  璋冨彇鍥剧焊
     [HttpPost("RetrieveDrawings")]
@@ -33,4 +36,25 @@
             return ResponseResult.ResponseError(ex);
         }
     }
+
+    //RetrieveDrawings  璋冨彇鍥剧焊
+    [HttpPost("OpenDrawings")]
+    public IActionResult OpenDrawings(string fileId,string fName)
+    {
+        try
+        {
+            var resultInfos = wdd.SendRequest("Download", fileId);
+
+            return File(resultInfos, "application/octet-stream", fName);
+        }
+        catch (Exception ex)
+        {
+            return StatusCode(500, new ResponseResult
+            {
+                status = 1,
+                message = ex.Message,
+                data = null
+            });
+        }
+    }
 }

--
Gitblit v1.9.3