From 7f15f2efc5dcf98a3b46cb156db24b71cb45e9df Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期三, 19 十月 2022 15:23:21 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/BLL/Xt_UserController.cs | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 250 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs index 38d1af4..2ffba78 100644 --- a/WebAPI/Controllers/BLL/Xt_UserController.cs +++ b/WebAPI/Controllers/BLL/Xt_UserController.cs @@ -852,5 +852,255 @@ } } #endregion + + #region 鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇敤鎴峰垪琛� + [Route("Xt_User/UserPlaylist")] + [HttpGet] + public object UserPlaylist(string HUserID) + { + try + { + + ds = oCN.RunProcReturn("select HUserID2,鐢ㄦ埛浠g爜 HUserNumber2,鐢ㄦ埛鍚嶇О HUserName2 from h_v_Gy_UserUserList where HUserID='" + HUserID + "' ", "h_v_Gy_UserUserList"); + 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 + + #region 鐢ㄦ埛鍏宠仈鐢ㄦ埛淇濆瓨 + [Route("Xt_User/SaveUserUser")] + [HttpPost] + public object SaveUserUser([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(); + + ListModels oListModels = new ListModels(); + try + { + List<Models.Gy_UserUser> lsmain = new List<Models.Gy_UserUser>(); + msg2 = msg2.Substring(1, msg2.Length - 2); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_UserUser(msg2); + oCN.BeginTran(); + //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹� + oCN.RunProc("Delete From Gy_UserByUserRelation where HUserID='" + msg3.ToString() + "'"); + foreach (Models.Gy_UserUser oItem in lsmain) + { + //閲嶆柊鍐欏叆鍏宠仈鏁版嵁 + oCN.RunProc("insert into Gy_UserByUserRelation (HUserID2,HUserID,HBillType,HUseFlag) values ('" + oItem.HUserID2 + "','" + 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/MaterPlaylist")] + [HttpGet] + public object MaterPlaylist(string HUserID) + { + try + { + + ds = oCN.RunProcReturn("select HMaterID,鐗╂枡浠g爜 HMaterNumber,鐗╂枡鍚嶇О HMaterName from h_v_Gy_UserMaterList where HUserID='" + HUserID + "' ", "h_v_Gy_UserMaterList"); + 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 + + #region 鐢ㄦ埛鍏宠仈鐗╂枡淇濆瓨 + [Route("Xt_User/SaveUserMater")] + [HttpPost] + public object SaveUserMater([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(); + + ListModels oListModels = new ListModels(); + try + { + List<Models.Gy_UserMater> lsmain = new List<Models.Gy_UserMater>(); + msg2 = msg2.Substring(1, msg2.Length - 2); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_UserMater(msg2); + oCN.BeginTran(); + //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹� + oCN.RunProc("Delete From Gy_UserMaterRelation where HUserID='" + msg3.ToString() + "'"); + foreach (Models.Gy_UserMater oItem in lsmain) + { + //閲嶆柊鍐欏叆鍏宠仈鏁版嵁 + oCN.RunProc("insert into Gy_UserMaterRelation (HMaterID,HUserID) values ('" + oItem.HMaterID + "','" + 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/CustomerPlaylist")] + [HttpGet] + public object CustomerPlaylist(string HUserID) + { + try + { + + ds = oCN.RunProcReturn("select HCusID,瀹㈡埛浠g爜 HCustomerNumber,瀹㈡埛鍚嶇О HCustomerName from h_v_Gy_UserCustomerList where HUserID='" + HUserID + "' ", "h_v_Gy_UserCustomerList"); + 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 + + #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(); + + 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 + } } \ No newline at end of file -- Gitblit v1.9.1