1
duhe
2024-01-23 178ef58efdb6e6fa1f3cc44c2b3b5a66d5200096
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;
            }
        }
@@ -1236,6 +1355,69 @@
        }
        #endregion
        #region 用户关联工位维护列表
        /// <summary>
        ///参数:string 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 用户代码 asc,工位代码 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 用户代码 asc,工位代码 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));//获取到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/SaveUserByWorkStation")]
        [HttpPost]
@@ -1276,6 +1458,105 @@
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region 用户关联工位维护 编辑初始化
        /// <summary>
        ///参数:string 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 用户代码 = '" + 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>
        ///参数:string 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;
            }
        }
@@ -2544,6 +2825,7 @@
            }
        }
        #endregion
        #region 用户关联客户维护 删除
        /// <summary>
        ///参数:string HInterID。
@@ -3215,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
    }
}