From dabfdd9dbf0364b1134daaad86af7e13f6437295 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期四, 30 十月 2025 12:40:30 +0800
Subject: [PATCH] XJ,SJ,RKJ检验项目序号,LLJ单个检验项目FTP附件信息

---
 StandardInterface/MES.Service/service/QC/LljService.cs |   41 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/StandardInterface/MES.Service/service/QC/LljService.cs b/StandardInterface/MES.Service/service/QC/LljService.cs
index 6f77e61..71d481a 100644
--- a/StandardInterface/MES.Service/service/QC/LljService.cs
+++ b/StandardInterface/MES.Service/service/QC/LljService.cs
@@ -89,7 +89,9 @@
                     // 娣诲姞璇勫鐘舵��
                     PSZT = a.PSZT,
                     // 娣诲姞妫�楠岄」鐩淮鎶ょ姸鎬�
-                    Jyxm = a.Jyxm
+                    Jyxm = a.Jyxm,
+                    // 娣诲姞鐗堟湰鍙凤紙鐢ㄤ簬FTP璺緞锛�
+                    Fversion = a.Fversion
                 })
                 .OrderBy("IQC_DATE DESC")
                 .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END")
@@ -164,7 +166,9 @@
                     // 娣诲姞璇勫鐘舵��
                     PSZT = a.PSZT,
                     // 娣诲姞妫�楠岄」鐩淮鎶ょ姸鎬�
-                    Jyxm = a.Jyxm
+                    Jyxm = a.Jyxm,
+                    // 娣诲姞鐗堟湰鍙凤紙鐢ㄤ簬FTP璺緞锛�
+                    Fversion = a.Fversion
                 })
                 .OrderBy("IQC_DATE DESC")
                 .OrderBy("CASE WHEN EMERGENCY = 1 THEN 0 ELSE 1 END")
@@ -504,7 +508,13 @@
         return input.Substring(startIndex + 1, length);
     }
 
-    public List<QamftpDto> GetAttachments(string ItemNo)
+    /// <summary>
+    /// 鑾峰彇闄勪欢淇℃伅
+    /// </summary>
+    /// <param name="ItemNo">鐗╂枡缂栫爜</param>
+    /// <param name="fversion">鐗堟湰鍙凤紙鍙�夛紝鐢ㄤ簬杩囨护锛�</param>
+    /// <returns>闄勪欢鍒楄〃</returns>
+    public List<QamftpDto> GetAttachments(string ItemNo, string fversion = null)
     {
         //if (string.IsNullOrEmpty(ItemNo))
         //{
@@ -514,8 +524,17 @@
         var db = SqlSugarHelper.GetInstance();
         try
         {
-            return db.Queryable<MesQamftp>()
+            var query = db.Queryable<MesQamftp>()
                 .Where(x => x.ItemNo == ItemNo)
+                .Where(x => x.Ftype == "鏉ユ枡妫�");  // 娣诲姞FTYPE = '鏉ユ枡妫�'鐨勯檺鍒�
+            
+            // 濡傛灉浼犲叆浜唂version锛屽垯鎸塅version杩囨护
+            if (!string.IsNullOrEmpty(fversion))
+            {
+                query = query.Where(x => x.Fversion == fversion);
+            }
+            
+            return query
                 .OrderBy(x => x.Fdate, OrderByType.Desc)
                 // .ThenBy(x => x.CreateDate, OrderByType.Desc)
                 .Select(x => new QamftpDto
@@ -543,7 +562,7 @@
         }
     }
 
-    public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer)
+    public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer, string fversion = null)
     {
         // 鍙傛暟楠岃瘉
         if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer))
@@ -557,8 +576,16 @@
         // 鏍囧噯鍖朏TP鏈嶅姟鍣ㄥ湴鍧�
         string normalizedServer = NormalizeFtpServer(ftpServer);
         
-        // 鏋勫缓FTP鏂囦欢璺緞
-        string ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fileName}";
+        // 鏋勫缓FTP鏂囦欢璺緞 - 鏉ユ枡妫�浣跨敤IQC鐩綍锛屼娇鐢╢version浣滀负瀛愮洰褰�
+        string ftpPath;
+        if (!string.IsNullOrEmpty(fversion))
+        {
+            ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fversion}/{fileName}";
+        }
+        else
+        {
+            ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fileName}";
+        }
         
         try
         {

--
Gitblit v1.9.3