zrg
2024-01-24 ff1f14aa3e83bf9084991c2e411f1d838a9ba81b
WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -681,7 +681,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region 用户关联组织保存
        [Route("Xt_User/SaveUserByOrg")]
@@ -990,6 +990,69 @@
        }
        #endregion
        #region 用户关联班组维护列表
        /// <summary>
        ///参数:string 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 用户代码 asc,班组代码 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 用户代码 asc,班组代码 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));//获取到DataColumn列对象的列名
                }
                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/SaveUserGroup")]
        [HttpPost]
@@ -1030,6 +1093,62 @@
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region 用户关联班组维护 删除
        /// <summary>
        ///参数:string 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;
            }
        }
@@ -1366,7 +1485,7 @@
                    return objJsonResult;
                }
                string sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query where HItemID = " + HItemID;
                string sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query where 用户代码 = '" + HItemID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query");
                objJsonResult.code = "1";
@@ -3378,5 +3497,124 @@
            }
        }
        #endregion
        #region 用户关联供应商维护列表
        /// <summary>
        ///参数:string 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 用户代码 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 用户代码 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));//获取到DataColumn列对象的列名
                }
                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>
        ///参数:string 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
    }
}