From db5e488203b05d785baf1614b727afaf20a03fe6 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期五, 19 十二月 2025 18:52:05 +0800
Subject: [PATCH] llj备注

---
 StandardInterface/MES.Service/service/QC/LljService.cs |   84 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 70 insertions(+), 14 deletions(-)

diff --git a/StandardInterface/MES.Service/service/QC/LljService.cs b/StandardInterface/MES.Service/service/QC/LljService.cs
index 6f77e61..f91c540 100644
--- a/StandardInterface/MES.Service/service/QC/LljService.cs
+++ b/StandardInterface/MES.Service/service/QC/LljService.cs
@@ -1,4 +1,4 @@
-锘縰sing System.Data;
+锘匡豢using System.Data;
 using System.Xml;
 using System.Linq;
 using Masuit.Tools;
@@ -52,7 +52,7 @@
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
                     a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
-                    a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                    a => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
                     a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
@@ -65,12 +65,15 @@
                     ItemName = a.ItemName,
                     ItemModel = a.ItemModel,
                     SuppName = a.SuppName,
+                    PaperBillNo = a.PaperBillNo,
                     LotNo = a.LotNo,
                     ReleaseNo = a.ReleaseNo,
                     FcheckResu = a.FcheckResu,
                     CreateDate = a.CreateDate,
                     FcovertQty = a.FcovertQty,
                     DEPARTMENTNAME = a.DEPARTMENTNAME,
+                    FcheckBy = a.FcheckBy,
+                    Modify1By = a.Modify1By,
                     FngDesc = a.FngDesc,
                     UrgentFlag = a.UrgentFlag,
                     Ftype = a.Ftype,
@@ -89,7 +92,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")
@@ -127,7 +132,7 @@
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
                     (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
-                    (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                    (a, v) => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
                     (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
@@ -140,6 +145,7 @@
                     ItemName = a.ItemName,
                     ItemModel = a.ItemModel,
                     SuppName = a.SuppName,
+                    PaperBillNo = a.PaperBillNo,
                     LotNo = a.LotNo,
                     ReleaseNo = a.ReleaseNo,
                     FcheckResu = a.FcheckResu,
@@ -150,6 +156,8 @@
                     UrgentFlag = a.UrgentFlag,
                     Ftype = a.Ftype,
                     LotNo1 = a.LotNo1,
+                    FcheckBy = a.FcheckBy,
+                    Modify1By = a.Modify1By,
                     EMERGENCY = a.EMERGENCY,
                     Status = a.Status,
                     IqcDate = a.IqcDate,
@@ -164,7 +172,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")
@@ -215,7 +225,7 @@
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
                     a => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
-                    a => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                    a => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
                     a => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
@@ -253,7 +263,7 @@
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 3, // 渚涘簲鍟嗘悳绱�
                     (a, v) => a.SuppName != null && a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 4, // 鍒拌揣鍗曞彿鎼滅储
-                    (a, v) => a.LotNo != null && a.LotNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
+                    (a, v) => a.PaperBillNo != null && a.PaperBillNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 5, // 妫�楠屽崟鍙锋悳绱�
                     (a, v) => a.ReleaseNo != null && a.ReleaseNo.ToLower().Contains(queryObj.SearchValue.ToLower()))
                 .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && queryObj.selectedIndex == 6, // 鐗╂枡瑙勬牸鎼滅储
@@ -504,7 +514,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 +530,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 +568,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 +582,19 @@
         // 鏍囧噯鍖朏TP鏈嶅姟鍣ㄥ湴鍧�
         string normalizedServer = NormalizeFtpServer(ftpServer);
         
-        // 鏋勫缓FTP鏂囦欢璺緞
-        string ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fileName}";
+        // 娓呯悊鏂囦欢鍚嶏細鍘婚櫎鎵�鏈夌┖鐧藉瓧绗︼紙鍖呮嫭涓嫳鏂囩┖鏍笺�佸埗琛ㄧ銆佸洖杞︽崲琛岀瓑锛�
+        fileName = System.Text.RegularExpressions.Regex.Replace(fileName, @"[\s\u3000\r\n]+", "");
+        
+        // 鏋勫缓FTP鏂囦欢璺緞 - 鏉ユ枡妫�浣跨敤IQC鐩綍锛屼娇鐢╢version浣滀负瀛愮洰褰�
+        string ftpPath;
+        if (!string.IsNullOrEmpty(fversion))
+        {
+            ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fversion}/{fileName}";
+        }
+        else
+        {
+            ftpPath = $"{normalizedServer}/IQC/{itemNo}/{fileName}";
+        }
         
         try
         {
@@ -641,8 +677,8 @@
             normalizedServer += ":21"; // 榛樿FTP绔彛
         }
         
-        // 寮�鍙戠幆澧冧娇鐢ㄦ湰鍦版湇鍔″櫒
-        normalizedServer = "ftp://192.168.1.22:21";
+        // 娉ㄩ噴鎺夊紑鍙戠幆澧冨己鍒惰鐩栵紝浣跨敤浼犲叆鐨勫疄闄匜TP鏈嶅姟鍣ㄥ湴鍧�
+        // normalizedServer = "ftp://192.168.1.22:21";
         
         return normalizedServer;
     }
@@ -1495,4 +1531,24 @@
         return match.Success ? int.Parse(match.Groups[1].Value) : 0;
     }
 
+
+    /// <summary>
+    /// 淇濆瓨澶囨敞鍒颁富琛�
+    /// </summary>
+    /// <param name="gid">涓昏〃ID</param>
+    /// <param name="releaseNo">妫�楠屽崟鍙�</param>
+    /// <param name="lotNo1">澶囨敞鍐呭</param>
+    /// <returns>褰卞搷琛屾暟</returns>
+    public int SaveLotNo1(decimal gid, string? releaseNo, string? lotNo1)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        return db.Updateable<MesQaItemsDetect01>()
+            .SetColumns(it => new MesQaItemsDetect01
+            {
+                LotNo1 = lotNo1
+            })
+            .Where(it => it.Id == gid && it.ReleaseNo == releaseNo)
+            .ExecuteCommand();
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.3