From 12d289e319ac1076b94aad69533c668a2a899c67 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 06 二月 2024 13:17:04 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/BLL/Xt_UserController.cs | 1723 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 1,682 insertions(+), 41 deletions(-)
diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index c40192f..4c60ad0 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -681,7 +681,7 @@
return objJsonResult;
}
}
- #endregion
+ #endregion
#region 鐢ㄦ埛鍏宠仈缁勭粐淇濆瓨
[Route("Xt_User/SaveUserByOrg")]
@@ -728,6 +728,316 @@
}
#endregion
+ #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢鍒楄〃
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationOrganizationList")]
+ [HttpGet]
+ public object UserRelationOrganizationList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Query", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ string sql = "";
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ sql = "select * from h_v_Gy_UserOrganizationRelationList_Query order by 鐢ㄦ埛浠g爜 asc,缁勭粐浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserOrganizationRelationList_Query");
+ }
+ else
+ {
+ sql = "select * from h_v_Gy_UserOrganizationRelationList_Query where 1=1 ";
+ sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,缁勭粐浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserOrganizationRelationList_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationOrganizationlist_Drop")]
+ [HttpGet]
+ public object UserRelationOrganizationlist_Drop(string HInterID, string user)
+ {
+ try
+ {
+ string s = "";
+
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Drop", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserORGRelation where HItemID = " + HInterID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢 缂栬緫鍒濆鍖�
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationOrganizationList_EditInit")]
+ [HttpGet]
+ public object UserRelationOrganizationList_EditInit(int HItemID, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Query", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ string sql = "select * from h_v_Gy_UserOrganizationRelationList_Query where HItemID = " + HItemID;
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserOrganizationRelationList_Query");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈缁勭粐缁存姢 淇濆瓨
+ [Route("Xt_User/UserRelationOrganizationList_Save")]
+ [HttpPost]
+ public object UserRelationOrganizationList_Save([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string user = sArray[1].ToString();
+ string saveType = sArray[2].ToString();
+ try
+ {
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationOrganization_Edit", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+ List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+ foreach (JObject item in Excel)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ foreach (var itm in item.Properties())
+ {
+ dic.Add(itm.Name, itm.Value.ToString());
+ }
+ list.Add(dic);
+ }
+
+ if (saveType == "1")
+ {
+ oCN.BeginTran();
+ string err = "";
+ int i = 1;
+ string sql = "";
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HItemID = item["HItemID"].ToString(); //
+ string HUserID = item["HUserID"].ToString(); //鐢ㄦ埛浠g爜
+ string HUserName = item["HUserName"].ToString(); //鐢ㄦ埛鍚嶇О
+ string HOrgID = item["HOrgID"].ToString(); //缁勭粐鍐呯爜
+ string HOrgNumber = item["HOrgNumber"].ToString(); //缁勭粐浠g爜
+ string HOrgName = item["HOrgName"].ToString(); //缁勭粐鍚嶇О
+
+
+ sql = "select * from Gy_UserORGRelation where HUserID = '" + HUserID + "' and HOrgID = " + HOrgID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserORGRelation");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sql = "insert into Gy_UserORGRelation(HUserID,HOrgID)" +
+ "values(" +
+ "'" + HUserID + "'" +
+ "," + HOrgID + "" +
+ ")";
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旂粍缁囥��" + HOrgName + "銆�";
+ }
+ i++;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪閿欒
+ if (err.Length > 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else if (saveType == "3")
+ {
+ oCN.BeginTran();
+ string err = "";
+ int i = 1;
+ string sql = "";
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HItemID = item["HItemID"].ToString(); //
+ string HUserID = item["HUserID"].ToString(); //鐢ㄦ埛浠g爜
+ string HUserName = item["HUserName"].ToString(); //鐢ㄦ埛鍚嶇О
+ string HOrgID = item["HOrgID"].ToString(); //缁勭粐鍐呯爜
+ string HOrgNumber = item["HOrgNumber"].ToString(); //缁勭粐浠g爜
+ string HOrgName = item["HOrgName"].ToString(); //缁勭粐鍚嶇О
+
+ sql = "select * from Gy_UserORGRelation where HItemID = " + HItemID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserORGRelation");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ sql = "select * from Gy_UserORGRelation where HUserID = '" + HUserID + "' and HOrgID = " + HOrgID + " and HItemID <> " + HItemID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserORGRelation");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sql = "update Gy_UserORGRelation set " +
+ "HUserID = '" + HUserID + "' " +
+ ",HOrgID = " + HOrgID + " " +
+ "where HItemID = " + HItemID;
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旂粍缁囥��" + HOrgName + "銆�";
+ }
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細璁板綍涓嶅瓨鍦�!";
+ }
+ i++;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪閿欒
+ if (err.Length > 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ LogService.Write(e);
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶄粨搴撳垪琛�
[Route("Xt_User/UserStocklistPlaylist")]
[HttpGet]
@@ -753,6 +1063,110 @@
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
+
+ #region 鐢ㄦ埛鍏宠仈浠撳簱鍒楄〃鏌ヨ
+ [Route("Xt_User/Gy_UserStockRelationList")]
+ [HttpGet]
+ public object Gy_UserStockRelationList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserStockRelation_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql1 = "select * from h_v_Gy_UserStockRelation where 1 = 1";
+ string sql = sql1 + sWhere + " order by 鐢ㄦ埛浠g爜 ";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserStockRelation");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈浠撳簱鍒楄〃 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/Gy_UserStockRelationDrop")]
+ [HttpGet]
+ public object Gy_UserStockRelationDrop(string HItemID, string user)
+ {
+ try
+ {
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserStockRelation_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HItemID == null || HItemID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HItemID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserStockRelation where HItemID = " + HItemID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
}
catch (Exception e)
{
@@ -810,6 +1224,45 @@
}
#endregion
+ #region 鐢ㄦ埛鍏宠仈鐢ㄦ埛鍒楄〃鏌ヨ
+ [Route("Xt_User/Gy_UserByUserList")]
+ [HttpGet]
+ public object Gy_UserByUserList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sql1 = "select * from h_v_Gy_UserByUserRelationList where 1 = 1";
+ string sql = sql1 + sWhere + " order by 鐢ㄦ埛浠g爜 ";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserStockRelation");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇彮缁勫垪琛�
[Route("Xt_User/UserGrouplistPlaylist")]
[HttpGet]
@@ -835,6 +1288,69 @@
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
+
+ #region 鐢ㄦ埛鍏宠仈鐝粍缁存姢鍒楄〃
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/Gy_UserGroupRelationList")]
+ [HttpGet]
+ public object Gy_UserGroupRelationList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "";
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ sql = "select * from h_v_Gy_UserGroupRelationList_Query order by 鐢ㄦ埛浠g爜 asc,鐝粍浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserGroupRelationList_Query");
+ }
+ else
+ {
+ sql = "select * from h_v_Gy_UserGroupRelationList_Query where 1=1 ";
+ sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,鐝粍浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserGroupRelationList_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
}
catch (Exception e)
{
@@ -887,6 +1403,62 @@
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈鐝粍缁存姢 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserGroupRelationList_Drop")]
+ [HttpGet]
+ public object UserGroupRelationList_Drop(string HInterID, string user)
+ {
+ try
+ {
+ string s = "";
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserGroupRelation where HItemID = " + HInterID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
return objJsonResult;
}
}
@@ -1093,6 +1665,69 @@
}
#endregion
+ #region 鐢ㄦ埛鍏宠仈宸ヤ綅缁存姢鍒楄〃
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserByWorkStationRelationList")]
+ [HttpGet]
+ public object UserByWorkStationRelationList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserWorkStationList_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "";
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query order by 鐢ㄦ埛浠g爜 asc,宸ヤ綅浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query");
+ }
+ else
+ {
+ sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query where 1=1 ";
+ sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,宸ヤ綅浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鐢ㄦ埛鍏宠仈宸ヤ綅淇濆瓨
[Route("Xt_User/SaveUserByWorkStation")]
[HttpPost]
@@ -1133,6 +1768,105 @@
objJsonResult.count = 0;
objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈宸ヤ綅缁存姢 缂栬緫鍒濆鍖�
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserByWorkStationRelationList_EditInit")]
+ [HttpGet]
+ public object UserByWorkStationRelationList_EditInit(int HItemID, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserWorkStationList_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query where 鐢ㄦ埛浠g爜 = '" + HItemID + "'";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈宸ヤ綅缁存姢 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserByWorkStationRelationList_Drop")]
+ [HttpGet]
+ public object UserByWorkStationRelationList_Drop(string HInterID, string user)
+ {
+ try
+ {
+ string s = "";
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserWorkStationList_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserByWorkStationRelation where HItemID = " + HInterID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
return objJsonResult;
}
}
@@ -1457,6 +2191,316 @@
}
#endregion
+ #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢鍒楄〃
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationEmployeelist")]
+ [HttpGet]
+ public object UserRelationEmployeelist(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Query", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ string sql = "";
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ sql = "select * from h_v_Gy_UserEmployeeRelationList_Query order by 鐢ㄦ埛浠g爜 asc,鑱屽憳浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserEmployeeRelationList_Query");
+ }
+ else
+ {
+ sql = "select * from h_v_Gy_UserEmployeeRelationList_Query where 1=1 ";
+ sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,鑱屽憳浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserEmployeeRelationList_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationEmployeelist_Drop")]
+ [HttpGet]
+ public object UserRelationEmployeelist_Drop(string HInterID, string user)
+ {
+ try
+ {
+ string s = "";
+
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Drop", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserEmployeeRelation where HItemID = " + HInterID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢 缂栬緫鍒濆鍖�
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationEmployeelist_EditInit")]
+ [HttpGet]
+ public object UserRelationEmployeelist_EditInit(int HItemID, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Query", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ string sql = "select * from h_v_Gy_UserEmployeeRelationList_Query where HItemID = " + HItemID;
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserEmployeeRelationList_Query");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈鑱屽憳缁存姢 淇濆瓨
+ [Route("Xt_User/UserRelationEmployeelist_Save")]
+ [HttpPost]
+ public object UserRelationEmployeelist_Save([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string user = sArray[1].ToString();
+ string saveType = sArray[2].ToString();
+ try
+ {
+ //if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationEmployee_Edit", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+ List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+ foreach (JObject item in Excel)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ foreach (var itm in item.Properties())
+ {
+ dic.Add(itm.Name, itm.Value.ToString());
+ }
+ list.Add(dic);
+ }
+
+ if (saveType == "1")
+ {
+ oCN.BeginTran();
+ string err = "";
+ int i = 1;
+ string sql = "";
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HItemID = item["HItemID"].ToString(); //
+ string HUserID = item["HUserID"].ToString(); //鐢ㄦ埛浠g爜
+ string HUserName = item["HUserName"].ToString(); //鐢ㄦ埛鍚嶇О
+ string HEmpID = item["HEmpID"].ToString(); //瀹㈡埛鍐呯爜
+ string HEmpNumber = item["HEmpNumber"].ToString(); //瀹㈡埛浠g爜
+ string HEmpName = item["HEmpName"].ToString(); //瀹㈡埛鍚嶇О
+
+
+ sql = "select * from Gy_UserEmployeeRelation where HUserID = '" + HUserID + "' and HEmployeeID = " + HEmpID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserEmployeeRelation");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sql = "insert into Gy_UserEmployeeRelation(HUserID,HEmployeeID)" +
+ "values(" +
+ "'" + HUserID + "'" +
+ "," + HEmpID + "" +
+ ")";
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旇亴鍛樸��" + HEmpName + "銆�";
+ }
+ i++;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪閿欒
+ if (err.Length > 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else if (saveType == "3")
+ {
+ oCN.BeginTran();
+ string err = "";
+ int i = 1;
+ string sql = "";
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HItemID = item["HItemID"].ToString(); //
+ string HUserID = item["HUserID"].ToString(); //鐢ㄦ埛浠g爜
+ string HUserName = item["HUserName"].ToString(); //鐢ㄦ埛鍚嶇О
+ string HEmpID = item["HEmpID"].ToString(); //鑱屽憳鍐呯爜
+ string HEmpNumber = item["HEmpNumber"].ToString(); //鑱屽憳浠g爜
+ string HEmpName = item["HEmpName"].ToString(); //鑱屽憳鍚嶇О
+
+ sql = "select * from Gy_UserEmployeeRelation where HItemID = " + HItemID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserEmployeeRelation");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ sql = "select * from Gy_UserEmployeeRelation where HUserID = '" + HUserID + "' and HEmployeeID = " + HEmpID + " and HItemID <> " + HItemID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserEmployeeRelation");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sql = "update Gy_UserEmployeeRelation set " +
+ "HUserID = '" + HUserID + "' " +
+ ",HEmployeeID = " + HEmpID + " " +
+ "where HItemID = " + HItemID;
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱旇亴鍛樸��" + HEmpName + "銆�";
+ }
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細璁板綍涓嶅瓨鍦�!";
+ }
+ i++;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪閿欒
+ if (err.Length > 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ LogService.Write(e);
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇敤鎴峰垪琛�
[Route("Xt_User/UserPlaylist")]
[HttpGet]
@@ -1565,6 +2609,109 @@
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
+
+ #region 鐢ㄦ埛鍏宠仈鐗╂枡鍒楄〃鏌ヨ
+ [Route("Xt_User/Gy_UserMaterList")]
+ [HttpGet]
+ public object Gy_UserMaterList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserMaterList_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql1 = "select * from h_v_Gy_UserMater where 1 = 1";
+ string sql = sql1 + sWhere + " order by 鐢ㄦ埛浠g爜 ";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserMater");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈鐗╂枡鍒楄〃 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/Gy_UserMaterRelationDrop")]
+ [HttpGet]
+ public object Gy_UserMaterRelationDrop(string HItemID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserMaterList_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HItemID == null || HItemID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HItemID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserMaterRelation where HItemID = " + HItemID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
}
catch (Exception e)
{
@@ -1720,6 +2867,63 @@
}
}
#endregion
+ #region 鐢ㄦ埛鍏宠仈瀹㈡埛淇濆瓨
+ [Route("Xt_User/SaveUserCustomer")]
+ [HttpPost]
+ public object SaveUserCustomer([FromBody] JObject msg)
+ {
+ var _value = msg["msg"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ string msg4 = sArray[2].ToString();
+
+ //鏌ヨ鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_UserRelationCustomer_Edit", 1, false, msg4))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ListModels oListModels = new ListModels();
+ try
+ {
+ List<Models.Gy_UserCustomer> lsmain = new List<Models.Gy_UserCustomer>();
+ msg2 = msg2.Substring(1, msg2.Length - 2);
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_Gy_UserCustomer(msg2);
+ oCN.BeginTran();
+ //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+ oCN.RunProc("Delete From Gy_UserCustomerRelation where HUserID='" + msg3.ToString() + "'");
+ foreach (Models.Gy_UserCustomer oItem in lsmain)
+ {
+ //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+ oCN.RunProc("insert into Gy_UserCustomerRelation (HCusID,HUserID) values ('" + oItem.HCusID + "','" + msg3.ToString() + "')");
+ }
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鐢ㄦ埛鍏宠仈瀹㈡埛 鏂囦欢涓婁紶
[Route("Xt_User/Gy_UserCustomer_ImportByExcel")]
[HttpPost]
@@ -2179,58 +3383,312 @@
}
#endregion
- #region 鐢ㄦ埛鍏宠仈瀹㈡埛淇濆瓨
- [Route("Xt_User/SaveUserCustomer")]
- [HttpPost]
- public object SaveUserCustomer([FromBody] JObject msg)
+ #region 鐢ㄦ埛鍏宠仈瀹㈡埛缁存姢鍒楄〃
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationCustomerlist")]
+ [HttpGet]
+ public object UserRelationCustomerlist(string sWhere, string user)
{
- var _value = msg["msg"].ToString();
- string msg1 = _value.ToString();
- string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg2 = sArray[0].ToString();
- string msg3 = sArray[1].ToString();
- string msg4 = sArray[2].ToString();
-
- //鏌ヨ鏉冮檺
- if (!DBUtility.ClsPub.Security_Log_second("Gy_UserRelationCustomer_Edit", 1, false, msg4))
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鏃犵紪杈戞潈闄愶紒";
- objJsonResult.data = null;
- return objJsonResult;
- }
-
- ListModels oListModels = new ListModels();
try
{
- List<Models.Gy_UserCustomer> lsmain = new List<Models.Gy_UserCustomer>();
- msg2 = msg2.Substring(1, msg2.Length - 2);
- msg2 = msg2.Replace("\\", "");
- msg2 = msg2.Replace("\n", ""); //\n
- lsmain = oListModels.getObjectByJson_Gy_UserCustomer(msg2);
- oCN.BeginTran();
- //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
- oCN.RunProc("Delete From Gy_UserCustomerRelation where HUserID='" + msg3.ToString() + "'");
- foreach (Models.Gy_UserCustomer oItem in lsmain)
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationCustomer_Query", 1, false, user))
{
- //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
- oCN.RunProc("insert into Gy_UserCustomerRelation (HCusID,HUserID) values ('" + oItem.HCusID + "','" + msg3.ToString() + "')");
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
}
- oCN.Commit();
+
+ string sql = "";
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ sql = "select * from h_v_Gy_UserCustomerRelationList_Query order by 鐢ㄦ埛浠g爜 asc,瀹㈡埛浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+ }
+ else
+ {
+ sql = "select * from h_v_Gy_UserCustomerRelationList_Query where 1=1 ";
+ sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,瀹㈡埛浠g爜 asc";
+ ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
- //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
- objJsonResult.data = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
- objJsonResult.data = 1;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈瀹㈡埛缁存姢 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationCustomerlist_Drop")]
+ [HttpGet]
+ public object UserRelationCustomerlist_Drop(string HInterID, string user)
+ {
+ try
+ {
+ string s = "";
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationCustomer_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserCustomerRelation where HItemID = " + HInterID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈瀹㈡埛缁存姢 缂栬緫鍒濆鍖�
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserRelationCustomerlist_EditInit")]
+ [HttpGet]
+ public object UserRelationCustomerlist_EditInit(int HItemID, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationCustomer_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "select * from h_v_Gy_UserCustomerRelationList_Query where HItemID = " + HItemID;
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserCustomerRelationList_Query");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 鐢ㄦ埛鍏宠仈瀹㈡埛缁存姢 淇濆瓨
+ [Route("Xt_User/UserRelationCustomerlist_Save")]
+ [HttpPost]
+ public object UserRelationCustomerlist_Save([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string user = sArray[1].ToString();
+ string saveType = sArray[2].ToString();
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationCustomer_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+ List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+ foreach (JObject item in Excel)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ foreach (var itm in item.Properties())
+ {
+ dic.Add(itm.Name, itm.Value.ToString());
+ }
+ list.Add(dic);
+ }
+
+ if (saveType == "1")
+ {
+ oCN.BeginTran();
+ string err = "";
+ int i = 1;
+ string sql = "";
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HItemID = item["HItemID"].ToString(); //
+ string HUserID = item["HUserID"].ToString(); //鐢ㄦ埛浠g爜
+ string HUserName = item["HUserName"].ToString(); //鐢ㄦ埛鍚嶇О
+ string HCusID = item["HCusID"].ToString(); //瀹㈡埛鍐呯爜
+ string HCusNumber = item["HCusNumber"].ToString(); //瀹㈡埛浠g爜
+ string HCusName = item["HCusName"].ToString(); //瀹㈡埛鍚嶇О
+
+
+ sql = "select * from Gy_UserCustomerRelation where HUserID = '" + HUserID + "' and HCusID = " + HCusID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sql = "insert into Gy_UserCustomerRelation(HUserID,HCusID)" +
+ "values(" +
+ "'" + HUserID + "'" +
+ "," + HCusID + "" +
+ ")";
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱斿鎴枫��" + HCusName + "銆�";
+ }
+ i++;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪閿欒
+ if (err.Length > 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else if (saveType == "3")
+ {
+ oCN.BeginTran();
+ string err = "";
+ int i = 1;
+ string sql = "";
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HItemID = item["HItemID"].ToString(); //
+ string HUserID = item["HUserID"].ToString(); //鐢ㄦ埛浠g爜
+ string HUserName = item["HUserName"].ToString(); //鐢ㄦ埛鍚嶇О
+ string HCusID = item["HCusID"].ToString(); //瀹㈡埛鍐呯爜
+ string HCusNumber = item["HCusNumber"].ToString(); //瀹㈡埛浠g爜
+ string HCusName = item["HCusName"].ToString(); //瀹㈡埛鍚嶇О
+
+ sql = "select * from Gy_UserCustomerRelation where HItemID = " + HItemID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ sql = "select * from Gy_UserCustomerRelation where HUserID = '" + HUserID + "' and HCusID = " + HCusID + " and HItemID <> " + HItemID;
+ ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+ if(ds.Tables[0].Rows.Count == 0)
+ {
+ sql = "update Gy_UserCustomerRelation set " +
+ "HUserID = '" + HUserID + "' " +
+ ",HCusID = " + HCusID + " " +
+ "where HItemID = " + HItemID;
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細鐢ㄦ埛銆�" + HUserName + "銆戝凡缁忓叧鑱斿鎴枫��" + HCusName + "銆�";
+ }
+ }
+ else
+ {
+ err += "绗�" + i + "琛岋細璁板綍涓嶅瓨鍦�!";
+ }
+ i++;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪閿欒
+ if (err.Length > 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + err;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ LogService.Write(e);
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
return objJsonResult;
}
}
@@ -2564,7 +4022,16 @@
try
{
List<object> columnNameList = new List<object>();
-
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserProcessList_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
string sql1 = "select * from h_v_Gy_UserProcess where 1 = 1";
string sql = sql1 + sWhere + " order by 鐢ㄦ埛浠g爜 ";
@@ -2595,5 +4062,179 @@
}
}
#endregion
+
+ #region 鐢ㄦ埛鍏宠仈宸ュ簭鍒楄〃 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/Gy_UserProcessDrop")]
+ [HttpGet]
+ public object Gy_UserProcessDrop(string HItemID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserProcessList_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ if (HItemID == null || HItemID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserByProcess where HItemID = " + HItemID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈渚涘簲鍟嗙淮鎶ゅ垪琛�
+ /// <summary>
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/Gy_UserSupplierRelationList")]
+ [HttpGet]
+ public object Gy_UserSupplierRelationList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserSupplierRelationList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "";
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ sql = "select * from h_v_Gy_UserSupplierRelationList_Query order by 鐢ㄦ埛浠g爜 asc,渚涘簲鍟嗕唬鐮� asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserSupplierRelationList_Query");
+ }
+ else
+ {
+ sql = "select * from h_v_Gy_UserSupplierRelationList_Query where 1=1 ";
+ sql = sql + sWhere + " order by 鐢ㄦ埛浠g爜 asc,渚涘簲鍟嗕唬鐮� asc";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_UserSupplierRelationList_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢ㄦ埛鍏宠仈渚涘簲鍟嗙淮鎶� 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xt_User/UserSupplierRelationList_Drop")]
+ [HttpGet]
+ public object UserSupplierRelationList_Drop(string HInterID, string user)
+ {
+ try
+ {
+ string s = "";
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_UserSupplierRelation_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ string sql = "delete from Gy_UserSupplierRelation where HItemID = " + HInterID;
+ oCN.RunProc(sql);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ 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