From 52169a0d87f14f922b1865212b20ce89f68d33df Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期三, 03 十二月 2025 10:00:04 +0800
Subject: [PATCH] 委外领料不能更新

---
 StandardInterface/MES.Service/service/QC/LljService.cs |   55 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/StandardInterface/MES.Service/service/QC/LljService.cs b/StandardInterface/MES.Service/service/QC/LljService.cs
index 6f77e61..eeb2956 100644
--- a/StandardInterface/MES.Service/service/QC/LljService.cs
+++ b/StandardInterface/MES.Service/service/QC/LljService.cs
@@ -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,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