From 8658c02633f9746781d2e6f5da9998eef8c0e0a7 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期五, 28 十月 2022 16:31:52 +0800 Subject: [PATCH] 动态列(点检项目、维修项目、维修检验项目、保养项目、产品与器具清单及维护、工作中心、工序、生产资源、生产班组、不良原因、故障原因、检验项目、检验项目分类、工序工价及维护、系统上机日志查询、系统参数查询、系统模块信息查询、系统单据类型、会计期间、公告信息维护) --- WebAPI/Controllers/BLL/Xt_UserController.cs | 338 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 335 insertions(+), 3 deletions(-) diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs index e7bf010..2ffba78 100644 --- a/WebAPI/Controllers/BLL/Xt_UserController.cs +++ b/WebAPI/Controllers/BLL/Xt_UserController.cs @@ -86,9 +86,9 @@ // return objJsonResult; //} - Int64 lngBillKey = 0; - lngBillKey = DBUtility.ClsPub.isLong(HCzybm); - if (lngBillKey == 0) + string lngBillKey = ""; + lngBillKey = DBUtility.ClsPub.isStrNull(HCzybm); + if (lngBillKey == "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -770,5 +770,337 @@ } } #endregion + + #region 鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶈亴鍛樺垪琛� + [Route("Xt_User/UserEmployeelistPlaylist")] + [HttpGet] + public object UserEmployeelistPlaylist(string HUserID) + { + try + { + + ds = oCN.RunProcReturn("select HEmployeeID HItemID,鑱屽憳浠g爜 HNumber,鑱屽憳鍚嶇О HName from h_v_Gy_UserEmployeeRelationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserEmployeeRelationList"); + 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/SaveUserEmployee")] + [HttpPost] + public object SaveUserEmployee([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.Employee> lsmain = new List<Models.Employee>(); + msg2 = msg2.Substring(1, msg2.Length - 2); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Employee(msg2); + oCN.BeginTran(); + //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹� + oCN.RunProc("Delete From Gy_UserEmployeeRelation where HUserID='" + msg3.ToString() + "'"); + foreach (Models.Employee oItem in lsmain) + { + //閲嶆柊鍐欏叆鍏宠仈鏁版嵁 + oCN.RunProc("insert into Gy_UserEmployeeRelation (HEmployeeID,HUserID) values ('" + oItem.HItemID + "','" + msg3.ToString() + "')"); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + 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/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