From d7f491034ae9694741178f17f809143f48470520 Mon Sep 17 00:00:00 2001
From: zyf <1071160500@qq.com>
Date: 星期四, 27 十一月 2025 13:12:19 +0800
Subject: [PATCH] 钉钉人员接口、检验撤回单据、首检保存备注

---
 MES.Service/service/QC/SJService.cs |   74 ++++++++++++++++++++++++++++++++++--
 1 files changed, 69 insertions(+), 5 deletions(-)

diff --git a/MES.Service/service/QC/SJService.cs b/MES.Service/service/QC/SJService.cs
index cfa9c93..7c1ddaa 100644
--- a/MES.Service/service/QC/SJService.cs
+++ b/MES.Service/service/QC/SJService.cs
@@ -114,7 +114,7 @@
                 Daa003 = a.Daa003,
                 Daa004 = a.Daa004,
                 Daa008 = a.Daa008,
-                LineName = a.LineName,
+                LineName = d.Departmentname == "娉ㄥ杞﹂棿" ? da.Daa020 : a.LineName,
                 SaleOrder = ca.Caa015,
                 DepartName = d.Departmentname,
                 PlanName = a.PlanName
@@ -572,7 +572,7 @@
     }
 
 
-    //涓昏〃淇敼澶囨敞瀛楁
+    //涓昏〃淇敼涓嶅悎鏍兼弿杩板瓧娈�
     public int saveRemarksGid(QsItem dto)
     {
         return SqlSugarHelper.UseTransactionWithOracle(db =>
@@ -580,6 +580,19 @@
             return db.Updateable<QsItemIpiReq>()
                 .SetColumns(it =>
                     it.Remarks == dto.Remarks) //SetColumns鏄彲浠ュ彔鍔犵殑 鍐�2涓氨2涓瓧娈佃祴鍊�
+                .Where(it => it.Id == dto.gid)
+                .ExecuteCommand();
+        });
+    }
+
+    //涓昏〃淇敼澶囨敞瀛楁
+    public int saveCommentGid(QsItem dto)
+    {
+        return SqlSugarHelper.UseTransactionWithOracle(db =>
+        {
+            return db.Updateable<QsItemIpiReq>()
+                .SetColumns(it =>
+                    it.Comments == dto.Comments) //SetColumns鏄彲浠ュ彔鍔犵殑 鍐�2涓氨2涓瓧娈佃祴鍊�
                 .Where(it => it.Id == dto.gid)
                 .ExecuteCommand();
         });
@@ -695,6 +708,57 @@
         }
     }
 
+    public bool SJQaReSubmit(QsItem item)
+    {
+
+        if (item == null)
+            throw new ArgumentNullException(nameof(item), "璐ㄦ椤规暟鎹笉鑳戒负绌�");
+
+        if (string.IsNullOrWhiteSpace(item.userNo))
+            throw new ArgumentException("鐢ㄦ埛缂栧彿涓嶈兘涓虹┖", nameof(item.userNo));
+
+        var (factory, company) = UserUtil.GetFactory(item.userNo);
+        try
+        {
+            // 瀹氫箟杈撳嚭鍙傛暟
+            var outputResult = new SugarParameter("o_Result", null, DbType.Int32, ParameterDirection.Output,
+                4000);
+
+            var outputMessage = new SugarParameter("o_Msg", null, DbType.String, ParameterDirection.Output, 4000);
+
+            // 瀹氫箟杈撳叆鍙傛暟
+            var parameters = new List<SugarParameter>
+         {
+
+             new("p_Id", item.gid, DbType.Int32,ParameterDirection.Input),
+             new("p_Flag", 2, DbType.Int32,ParameterDirection.Input),
+             new("p_User", item.userNo, DbType.String, ParameterDirection.Input),
+             outputResult,
+             outputMessage
+         };
+
+            var db = SqlSugarHelper.GetInstance();
+
+            // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼
+            db.Ado.ExecuteCommand(
+                "BEGIN PRC_WOMDAA_SJ_UPDATE_RES(:p_Id,:p_Flag,:p_User,:o_Result, :o_Msg); END;",
+                parameters.ToArray());
+
+            // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+            var resultValue = outputResult.Value?.ToString();
+            var messageValue = outputMessage.Value?.ToString();
+
+            if ("1".Equals(resultValue)) { throw new Exception(messageValue); }
+            if ("0".Equals(resultValue)) { throw new Exception(messageValue); }
+
+            return true;
+        }
+        catch (Exception ex)
+        {
+            throw new Exception(ex.Message);
+        }
+    }
+
     /// <summary>
     /// 鏇存柊QsItemIpiItem鐨処sPass鍊�
     /// </summary>
@@ -707,7 +771,7 @@
         {
             return db.Updateable<QsItemIpiItemDetail>()
                 .SetColumns(s => s.FcheckResu == isPass.ToString())
-                .SetColumns(s => s.Fstand == ((isPass == 1) ? "鈭�" : "0"))
+                .SetColumns(s => s.Fstand == ((isPass == 1) ? "鈭�" : "脳"))
                 .Where(s => s.Pid == id)
                 .ExecuteCommand();
         });
@@ -861,11 +925,11 @@
 
         var db = SqlSugarHelper.GetInstance();
 
-        decimal numUserId = db.Queryable<DingStaff>()
+        string numUserId = db.Queryable<DingStaff>()
             .Where(t => t.StaffName == InData.Fname)
             .Select(t => t.Id)
             .First();
-        if (numUserId > 0)
+        if (numUserId is not null)
         {
             string UserId = Convert.ToString(numUserId);
 

--
Gitblit v1.9.3