From 005ea86446e567e49e3604b5e01e8b4001f4e617 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 19 三月 2024 16:14:24 +0800
Subject: [PATCH] 用户关联客户维护新增、编辑、导入时:判断当前客户是否已经被其他人关联。

---
 WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs |   71 +++++++++++++++++++++++++++--------
 1 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
index 998dc2b..8d8bc56 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -1737,22 +1737,18 @@
                 }
                 if (IsAudit == 1) //鍙嶅叧闂彁浜�
                 {
-                    oBill.oCn.BeginTran();
+                    ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl");
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                     //鍙嶅叧闂彁浜�
                     if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
-                        ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl");
-                        if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
-                            objJsonResult.data = null;
-                            oBill.oCn.RollBack();
-                            return objJsonResult;
-                        }
-
-                        oBill.oCn.Commit();
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
                         objJsonResult.Message = "鍙嶅叧闂垚鍔�";
@@ -1765,7 +1761,6 @@
                         objJsonResult.count = 0;
                         objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
                         objJsonResult.data = null;
-                        oBill.oCn.RollBack();
                         return objJsonResult;
                     }
                 }
@@ -1941,12 +1936,11 @@
                             oBill.oCn.RollBack();
                             return objJsonResult;
                         }
-
-                        oBill.oCn.Commit();
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
                         objJsonResult.Message = "鍙嶅叧闂垚鍔�";
                         objJsonResult.data = null;
+                        oBill.oCn.Commit();
                         return objJsonResult;
                     }
                     else
@@ -2232,7 +2226,7 @@
                 }
                 else
                 {
-                    sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "') ";
+                    sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "' union all select 166351 hcusid)";
                 }
 
                 objJsonResult.code = "1";
@@ -2466,5 +2460,48 @@
             }
         }
         #endregion
+
+        #region 閿�鍞鍗� 鏍规嵁鑱屽憳鑾峰彇閮ㄩ棬銆佷富绠�
+        [Route("Xs_SeOrderBill/getEmpInfoByHEmpID")]
+        [HttpGet]
+        public object getEmpInfoByHEmpID(long HEmpID)
+        {
+            try
+            {
+                string sql = "select a.HItemID HEmpID,a.HName HEmpName,ISNULL(a.HDeptID,0) HDeptID,b.HName HDeptName,ISNULL(b.HEmpID,0) HManagerID,c.HName HManagerName " +
+                    " from Gy_Employee as a " +
+                    " left join Gy_Department as b on a.HDeptID = b.HItemID " +
+                    " left join Gy_Employee as c on b.HEmpID = c.HItemID " +
+                    " where a.HItemID = " + HEmpID;
+                ds = oCN.RunProcReturn(sql, "Gy_Employee");
+
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ヨ亴鍛樹俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1