From d996b88f0b0426765138abebdcb07d90780bd292 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期五, 12 七月 2024 16:59:09 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs |   52 +++++++++++++++++++++++++++-------------------------
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
index 5352023..b0a1306 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -6628,20 +6628,24 @@
             string appKey = "";
             string appSecret = "";
             string sReturn = "";
+            string agentIds = "";
             Cls_DDMsg msg = new Cls_DDMsg();
             if (oSystemParameter.ShowBill(ref sReturn) == true)
             {
-                //绯荤粺鍙傛暟鏄惁涓虹鏈変簯妯″紡,N涓烘湰鍦帮紝Y涓烘柉鑾皵
+                //绯荤粺鍙傛暟鏄惁 N涓烘湰鍦帮紝Y涓烘柉鑾皵
                 if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "N")
                 {
-                     appKey = "dingrsrzhdyn3mlaof95";
+                    appKey = "dingrsrzhdyn3mlaof95";
                      appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq";
+                    agentIds = "3118119317";
                 }
-                else
+                else if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "Y")
                 {
-                     appKey = "dingkdddbhdcssk7jduw";
-                     appSecret = "iv07c-GLfJPnzfJaNAAOfJDl3Z-eODvDAhlInMZCZhGorkle5Evbaxx3ImylvdjQ";
+                    appKey = "dingkdddbhdcssk7jduw";
+                    appSecret = "iv07c-GLfJPnzfJaNAAOfJDl3Z-eODvDAhlInMZCZhGorkle5Evbaxx3ImylvdjQ";
+                    agentIds = "3151454458";
                 }
+
             }
 
             if (HHandleEmpID==0) //寮傚父鍙嶉楠屾敹鍗曚繚瀛�  灏嗘秷鎭� 鍙戦�佺粰 鎺ユ敹浜猴紝鎸囨淳澶勭悊浜猴紝鍏ㄩ儴鎶勯�佷汉 
@@ -6671,7 +6675,7 @@
                 //鑾峰彇鍙戦�佷汉  鎺ユ敹浜�
                 string HReceiveMan = HCopyMan;
                 string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HReceiveMan + "')";
-                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
+                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");               
                 List<string> HNames = new List<string>();
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
@@ -6689,6 +6693,7 @@
                 string HHandleEmpName = ds.Tables[0].Rows[0]["HName"].ToString();
                 //鑾峰彇鎸囨淳澶勭悊浜�,鍙戦�佷汉鐨勯拤閽塱d
                 string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HHandleEmpName + "')";
+                LogService.CustomWriteLog("10鍙傛暟" + sql1, "寮傚父缃氭");
                 ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
                 List<string> HNames = new List<string>();
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
@@ -6698,6 +6703,7 @@
 
                 }
                 concatenatedNames = string.Join(",", HNames);
+                LogService.CustomWriteLog("9鍙傛暟" + concatenatedNames, "寮傚父缃氭");
             }
           
             //鑾峰彇浼佷笟鐨刟ccess_token鐨勫��
@@ -6707,7 +6713,7 @@
             string accessToken = responseJson["accessToken"].ToString();
 
             //璋冪敤鏂规硶鍙戦�佹秷鎭�           
-            string agentId = "3118119317";//閽夐拤鍚庡彴寤虹珛鐨勫皬绋嬪簭id
+            string agentId = agentIds;//閽夐拤鍚庡彴寤虹珛鐨勫皬绋嬪簭id
             string userIdList = concatenatedNames;//閽夐拤浜哄憳鐨刬d
             string deptIdList = "0"; // 绌哄瓧绗︿覆琛ㄧず涓嶆寚瀹氶儴闂�
             string toAllUser = "false";
@@ -6853,32 +6859,28 @@
         {
             try
             {
-                string sReturn = "";
+                //string sReturn = "";
                 List<object> columnNameList = new List<object>();
                 //鏍规嵁褰撳墠浜鸿幏鍙栬亴鍔�
                 string sql = "select a.Czymc 鐢ㄦ埛鍚嶇О,c.GroupName 鑱屽姟 from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where a.Czymc = '"+HName+"'";
                 ds = oCN.RunProcReturn(sql, "Gy_ErrMsgBackType");
                 string Job = ds.Tables[0].Rows[0]["鑱屽姟"].ToString();
-                if (oSystemParameter.ShowBill(ref sReturn) == true)
+                if (Job=="娉ㄥ鐝粍闀�" || Job=="鍚庡鐞嗙彮缁勯暱")
                 {
-                    //绯荤粺鍙傛暟鏄惁涓虹鏈変簯妯″紡,N涓烘湰鍦帮紝Y涓烘柉鑾皵
-                    if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "N")
-                    {
-                         Job = ds.Tables[0].Rows[0]["鑱屽姟"].ToString();
-                    }
-                    else
-                    {
-                        Job = "娉ㄥ鐝粍闀�";
-                    }
+                    //鏍规嵁鑱屽姟鎵惧埌浠栫殑涓嬬骇,缁欏彂閫佷汉榛樿涓虹彮缁勯暱涔嬩笅
+                    string sql1 = "select * from Gy_Duty where HParentID =(select HItemID from Gy_Duty group by HItemID, HName having HName = '"+Job+"' and count(*) = 1)";
+                    ds = oCN.RunProcReturn(sql1, "Gy_Duty");
                 }
-                
-                //鏍规嵁鑱屽姟鎵惧埌浠栫殑涓婄骇
-                string sql1 = "select *  from Gy_Duty where HParentID=(select HParentID from Gy_Duty where HItemID =(select HParentID from Gy_Duty group by HParentID, HName having HName = '"+Job+"' and count(*) = 1))";
-                ds = oCN.RunProcReturn(sql1, "Gy_Duty");               
+                else
+                {
+                    //鏍规嵁鑱屽姟鎵惧埌浠栫殑涓婄骇
+                    string sql2 = "select * from Gy_Duty where HItemID =(select HParentID from Gy_Duty group by HParentID, HName having HName = '" + Job + "' and count(*) = 1)";
+                    ds = oCN.RunProcReturn(sql2, "Gy_Duty");
+                }                                  
                 string Job1= ds.Tables[0].Rows[0]["HName"].ToString(); 
-                //鐢ㄤ笂绾х殑鑱屽姟鎵惧埌鐢ㄦ埛
-                string sql2 = "select a.Czymc 鐢ㄦ埛鍚嶇О  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where c.GroupName = '"+Job1+"'";
-                ds = oCN.RunProcReturn(sql2, "Gy_Czygl");
+                //鐢ㄨ亴鍔℃壘鍒扮敤鎴�
+                string sql3 = "select a.Czymc 鐢ㄦ埛鍚嶇О,c.GroupName 鑱屽姟  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where c.GroupName = '" + Job1+"'";
+                ds = oCN.RunProcReturn(sql3, "Gy_Czygl");
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {

--
Gitblit v1.9.1