using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers.基础资料.基础资料 { public class Xt_CheckFlowProgressBillController : ApiController { private json objJsonResult = new json(); public DataSet ds = new DataSet(); public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); #region 审核进度列表 [Route("Xt_CheckFlowProgressBill/getList_CheckFlowProgress")] [HttpGet] public object getList_CheckFlowProgress(string sWhere, string user) { try { List columnNameList = new List(); ////查看权限 //if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBackBillQuery", 1, false, user)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无查看权限!"; // objJsonResult.data = null; // return objJsonResult; //} if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("select * from h_v_Xt_CheckFlowProcessList order by 审批项目次序 asc", "h_v_Xt_CheckFlowProcessList"); } else { string sql1 = "select * from h_v_Xt_CheckFlowProcessList where 1 = 1 "; string sql = sql1 + sWhere + " order by 审批项目次序 asc"; ds = oCN.RunProcReturn(sql, "h_v_Xt_CheckFlowProcessList"); } if (ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!当前单据未发起审批!"; objJsonResult.data = null; return objJsonResult; } //添加列名 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_CheckFlowProgressBill/getList_CheckFlowList")] [HttpGet] public object getList_CheckFlowList(string sWhere, string user) { try { string sql = "select distinct a.HInterID,a.HName 审批流,a.HStandard " + "from Xt_CheckFlowMain as a " + "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " + "inner join Xt_CheckUserRight as c on b.HInterID = c.HCheckFlowInterID and b.HCheckItemID = c.HCheckItemID " + "where 1=1 "; if (sWhere == null || sWhere.Equals("")) { sql = sql + " order by a.HStandard desc"; ds = oCN.RunProcReturn(sql, "Xt_CheckFlowMain"); } else { sql = sql + sWhere + " order by a.HStandard desc"; ds = oCN.RunProcReturn(sql, "Xt_CheckFlowMain"); } if (ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!未查询到相关数据!"; objJsonResult.data = null; return objJsonResult; } 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 } }