| | |
| | | // 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; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据用户编码查找已分配组织列表 |
| | | [Route("Xt_User/UserByOrgPlaylist")] |
| | | [HttpGet] |
| | | public object UserByOrgPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HOrgID HItemID,对应组织代码 HNumber,对应组织名称 HName from h_v_Gy_UserByOrgRelationList where 用户编码='" + HUserID + "' ", "h_v_Gy_UserByOrgRelationList"); |
| | | 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/SaveUserByOrg")] |
| | | [HttpPost] |
| | | public object SaveUserByOrg([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.Xt_ORGANIZATIONS> lsmain = new List<Models.Xt_ORGANIZATIONS>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Xt_ORGANIZATIONS(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserByOrgRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Xt_ORGANIZATIONS oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserByOrgRelation (HOrgID,HBillType,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/UserStocklistPlaylist")] |
| | | [HttpGet] |
| | | public object UserStocklistPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HWHID HItemID,仓库代码 HNumber,仓库名称 HName from h_v_Gy_UserStockRelationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserStockRelationList"); |
| | | 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/SaveUserStock")] |
| | | [HttpPost] |
| | | public object SaveUserStock([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.Warehouse> lsmain = new List<Models.Warehouse>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Warehouse(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserStockRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Warehouse oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserStockRelation (HWHID,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/UserGrouplistPlaylist")] |
| | | [HttpGet] |
| | | public object UserGrouplistPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HGroupID HItemID,班组代码 HNumber,班组名称 HName from h_v_Gy_UserGroupRelationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserGroupRelationList"); |
| | | 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/SaveUserGroup")] |
| | | [HttpPost] |
| | | public object SaveUserGroup([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_Group> lsmain = new List<Models.Gy_Group>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_Group(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserGroupRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Gy_Group oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserGroupRelation (HGroupID,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/UserDeptlistPlaylist")] |
| | | [HttpGet] |
| | | public object UserDeptlistPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HDeptID HItemID,部门代码 HNumber,部门名称 HName from h_v_Gy_UserDeptRelationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserDeptRelationList"); |
| | | 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/SaveUserDept")] |
| | | [HttpPost] |
| | | public object SaveUserDept([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.Department> lsmain = new List<Models.Department>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Department(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserDeptRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Department oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserDeptRelation (HDeptID,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/UserByWorkStationlistPlaylist")] |
| | | [HttpGet] |
| | | public object UserByWorkStationlistPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HWorkStationID HItemID,工位代码 HNumber,工位名称 HName from h_v_Gy_UserByWorkStationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserByWorkStationList"); |
| | | 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/SaveUserByWorkStation")] |
| | | [HttpPost] |
| | | public object SaveUserByWorkStation([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.Department> lsmain = new List<Models.Department>(); |
| | | msg2 = msg2.Substring(1, msg2.Length - 2); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Department(msg2); |
| | | oCN.BeginTran(); |
| | | //删除已经关联的数据 |
| | | oCN.RunProc("Delete From Gy_UserByWorkStationRelation where HUserID='" + msg3.ToString() + "'"); |
| | | foreach (Models.Department oItem in lsmain) |
| | | { |
| | | //重新写入关联数据 |
| | | oCN.RunProc("insert into Gy_UserByWorkStationRelation (HWorkStationID,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/UserEmployeelistPlaylist")] |
| | | [HttpGet] |
| | | public object UserEmployeelistPlaylist(string HUserID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select HEmployeeID HItemID,职员代码 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 |
| | | } |
| | | } |