From 0c7322109660b80e359118de04c0b9cc16a030e3 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期五, 10 十月 2025 15:45:31 +0800
Subject: [PATCH] SJ,XJ,RKJ调用FTP附件

---
 StandardInterface/MESApplication/Controllers/QC/RKJController.cs |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
index 2f8057f..9ed886f 100644
--- a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
@@ -574,16 +574,26 @@
     /// <summary>
     /// 鑾峰彇闄勪欢淇℃伅
     /// </summary>
-    /// <param name="data">鍖呭惈itemNo鐨凧SON瀵硅薄</param>
+    /// <param name="data">鍖呭惈itemNo銆乸rojName銆乫romPage鐨凧SON瀵硅薄</param>
     /// <returns>闄勪欢鍒楄〃</returns>
     [HttpPost("getAttachments")]
     public ResponseResult GetAttachments([FromBody] JObject data)
     {
         var itemNo = data["itemNo"]?.ToString();
+        var projName = data["projName"]?.ToString();
+        var fromPage = data["fromPage"]?.ToString(); // 鏂板鍙傛暟
+
+        // 鏉′欢杩囨护閫昏緫锛氭牴鎹甪romPage鍐冲畾鏄惁杩囨护
+        string filterProjName = null;
+        if (fromPage == "Detail" && !string.IsNullOrEmpty(projName))
+        {
+            filterProjName = projName;  // Detail椤甸潰闇�瑕佽繃婊�
+        }
+
         try
         {
             dynamic resultInfos = new System.Dynamic.ExpandoObject();
-            var tbBillList = new RKJService().GetAttachments(itemNo);
+            var tbBillList = new RKJService().GetAttachments(itemNo, filterProjName);
             if (tbBillList == null || tbBillList.Count == 0)
             {
                 return new ResponseResult
@@ -612,10 +622,10 @@
     /// </summary>
     /// <param name="itemNo">鐗╂枡缂栫爜</param>
     /// <param name="fileName">鏂囦欢鍚�</param>
-    /// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+    /// <param name="projName">椤圭洰鍚嶇О</param>
     /// <returns>鏂囦欢鍐呭</returns>
-    [HttpGet("PreviewFtpFile")]
-    public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer)
+    [HttpGet("previewFtpFile")]
+    public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string projName = null)
     {
         try
         {
@@ -626,7 +636,7 @@
             Response.Headers.Add("Access-Control-Expose-Headers", "Content-Type, Content-Length");
             
             var service = new RKJService();
-            var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer);
+            var fileBytes = service.GetFtpFile(itemNo, fileName, projName);
             
             if (fileBytes == null || fileBytes.Length == 0)
             {
@@ -649,10 +659,10 @@
     /// </summary>
     /// <param name="itemNo">鐗╂枡缂栫爜</param>
     /// <param name="fileName">鏂囦欢鍚�</param>
-    /// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+    /// <param name="projName">椤圭洰鍚嶇О</param>
     /// <returns>鏂囦欢涓嬭浇</returns>
-    [HttpGet("DownloadFtpFile")]
-    public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer)
+    [HttpGet("downloadFtpFile")]
+    public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string projName = null)
     {
         try
         {
@@ -663,7 +673,7 @@
             Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition, Content-Length, Content-Type");
             
             var service = new RKJService();
-            var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer);
+            var fileBytes = service.GetFtpFile(itemNo, fileName, projName);
             
             if (fileBytes == null || fileBytes.Length == 0)
             {

--
Gitblit v1.9.3