From 1be2fc056943ba8b9e62328430e15beee03e8a9f Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期一, 02 六月 2025 13:46:48 +0800
Subject: [PATCH] 1.生产补料优化 2.首检开发-v1

---
 service/QC/IpqcService.cs |   80 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/service/QC/IpqcService.cs b/service/QC/IpqcService.cs
index 4a34a12..5fb5477 100644
--- a/service/QC/IpqcService.cs
+++ b/service/QC/IpqcService.cs
@@ -87,7 +87,11 @@
                 a.Order,
                 a.Ybsl,
                 a.ISRZXX,
-                a.IPQCRZXX
+                a.IPQCRZXX,
+                a.IPQCRZXXDate,
+                a.IPQCRZXXNum,
+                a.IPQCpscs,
+                a.FcheckType,
             }).Select((a, b) => new MesQaItemsDetectDetail5
             {
                 Guid = a.Guid,
@@ -112,7 +116,11 @@
                 Ybsl = a.Ybsl,
                 YbslIn = Ybsl_In,
                 ISRZXX = a.ISRZXX,
-                IPQCRZXX = a.IPQCRZXX
+                IPQCRZXX = a.IPQCRZXX,
+                IPQCRZXXDate = a.IPQCRZXXDate.ToString(),
+                IPQCRZXXNum = a.IPQCRZXXNum,
+                IPQCpscs = a.IPQCpscs,
+                FcheckType =a.FcheckType,
             }).OrderBy(a => a.Order)
             .ToList();
     }
@@ -259,4 +267,72 @@
 
         return result;
     }
+
+    public List<dynamic> GetRzxxList(string mxguid)
+    {
+        var sqlParams = new List<SugarParameter> {
+            new("@mxguid", mxguid)
+        };
+
+        var sql = @"SELECT a.s_type, a.defect_name 
+                    FROM [dbo].[MES_DEFECT_CODE] a 
+                    WHERE a.s_type = '璁よ瘉淇℃伅' 
+                    AND a.pid = ( 
+                        SELECT TOP 1 b.guid 
+                        FROM [dbo].[MES_DEFECT_CODE] b 
+                        INNER JOIN [dbo].[MES_QA_ITEMS_DETECT_DETAIL5] d 
+                            ON b.defect_name = d.fcheck_item 
+                        WHERE d.guid = @mxguid 
+                        ORDER BY b.guid 
+                    )";
+
+        var result = Db.Ado.SqlQuery<dynamic>(sql, sqlParams);
+        
+        if (result == null || result.Count == 0)
+            throw new Exception("鏈壘鍒扮浉鍏宠璇佷俊鎭�");
+
+        return result;
+    }
+
+    public int UpdateScDate(string scDateValue, string mxguid)
+    {
+        var sqlParams = new List<SugarParameter> {
+            new("@scDateValue", scDateValue),
+            new("@mxguid", mxguid)
+        };
+
+        var sql = @"UPDATE MES_QA_ITEMS_DETECT_DETAIL5 
+                    SET ipqc_rzxx_date = @scDateValue 
+                    WHERE guid = @mxguid";
+
+        return Db.Ado.ExecuteCommand(sql, sqlParams);
+    }
+
+    public int UpdateRzxxNum(string ipqcrzxxNum, string mxguid)
+    {
+        var sqlParams = new List<SugarParameter> {
+            new("@ipqcrzxxNum", ipqcrzxxNum),
+            new("@mxguid", mxguid)
+        };
+
+        var sql = @"UPDATE MES_QA_ITEMS_DETECT_DETAIL5 
+                    SET ipqc_rzxx_num = @ipqcrzxxNum 
+                    WHERE guid = @mxguid";
+
+        return Db.Ado.ExecuteCommand(sql, sqlParams);
+    }
+
+    public int UpdateCpscs(string ipqCpscs, string mxguid)
+    {
+        var sqlParams = new List<SugarParameter> {
+            new("@ipqCpscs", ipqCpscs),
+            new("@mxguid", mxguid)
+        };
+
+        var sql = @"UPDATE MES_QA_ITEMS_DETECT_DETAIL5 
+                    SET ipqc_pscs = @ipqCpscs 
+                    WHERE guid = @mxguid";
+
+        return Db.Ado.ExecuteCommand(sql, sqlParams);
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3