WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -765,6 +765,110 @@
        }
        #endregion
        #region  用户关联仓库列表查询
        [Route("Xt_User/Gy_UserStockRelationList")]
        [HttpGet]
        public object Gy_UserStockRelationList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_UserStockRelation_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from h_v_Gy_UserStockRelation where 1 = 1";
                string sql = sql1 + sWhere + " order by 用户代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_UserStockRelation");
                //添加列名
                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/Gy_UserStockRelationDrop")]
        [HttpGet]
        public object Gy_UserStockRelationDrop(string HItemID, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_UserStockRelation_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HItemID == null || HItemID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                string sql = "delete from Gy_UserStockRelation where HItemID = " + HItemID;
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                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
        #region 用户关联仓库保存
        [Route("Xt_User/SaveUserStock")]
        [HttpPost]
@@ -1565,6 +1669,109 @@
                    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/Gy_UserMaterList")]
        [HttpGet]
        public object Gy_UserMaterList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_UserMaterList_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from h_v_Gy_UserMater where 1 = 1";
                string sql = sql1 + sWhere + " order by 用户代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_UserMater");
                //添加列名
                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/Gy_UserMaterRelationDrop")]
        [HttpGet]
        public object Gy_UserMaterRelationDrop(string HItemID, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_UserMaterList_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HItemID == null || HItemID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                string sql = "delete from Gy_UserMaterRelation where HItemID = " + HItemID;
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
@@ -2823,8 +3030,8 @@
                    string HProcID = item["HProcID"].ToString();//工序ID
                    string HUserID = item["用户代码"].ToString();//用户代码
                    string czymc = item["用户名称"].ToString();//用户名称
                    string HNumber = item["工序代码"].ToString();//供应商代码
                    string HName = item["工序名称"].ToString();//供应商名称
                    string HNumber = item["工序代码"].ToString();//工序代码
                    string HName = item["工序名称"].ToString();//工序名称
                    var ds = oCN.RunProcReturn("select * from Gy_UserByProcess where  HProcID='" + HProcID + "'and HUserID='" + HUserID + "'", "Gy_UserByProcess");
@@ -2865,5 +3072,109 @@
            }
        }
        #endregion
        #region  用户关联工序列表查询
        [Route("Xt_User/UserProcesslist")]
        [HttpGet]
        public object UserProcesslist(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_UserProcessList_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from h_v_Gy_UserProcess where 1 = 1";
                string sql = sql1 + sWhere + " order by 用户代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_UserProcess");
                //添加列名
                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/Gy_UserProcessDrop")]
        [HttpGet]
        public object Gy_UserProcessDrop(string HItemID, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_UserProcessList_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HItemID == null || HItemID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                string sql = "delete from Gy_UserByProcess where HItemID = " + HItemID;
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                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
    }
}