| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | |
| | | /// <summary> |
| | | #region 采购订单分页列表 |
| | | [Route("Cg_POOrderBill/page")] |
| | | [HttpGet] |
| | | public object Cg_POOrderBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | json res = new json(); |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //判断权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBillList", 3, false, user)) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "您没有该模块权限,请与管理员联系!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否有采购经理权限(安瑞) |
| | | bool isCgjl = Security_Log("Cg_POOrderBill_PurchasManager", 1, true, user); |
| | | if (!isCgjl) |
| | | { |
| | | sWhere += $" and HEmpID in (select HEmpID from Gy_Czygl where Czymc='{user}' and HEmpID >0 )"; |
| | | } |
| | | |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_IF_POOrderBillList " + page + "," + size + ",''", "h_p_IF_POOrderBillList"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_IF_POOrderBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_IF_POOrderBillList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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列对象的列名 |
| | | } |
| | | |
| | | res.code = CodeConstant.SUCCEED; |
| | | res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | res.Message = "Sucess!"; |
| | | res.list = columnNameList; |
| | | res.data = ds.Tables[0]; |
| | | return res; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | res.code = CodeConstant.FAIL; |
| | | res.count = CountConstant.FAIL; |
| | | res.Message = "Exception!" + e.ToString(); |
| | | res.data = null; |
| | | return res; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 返回采购订单列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |