yusijie
2024-09-18 359be0508a24daeabe1e687265aa6783961d1221
WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
@@ -1894,5 +1894,143 @@
            }
        }
        #endregion
        #region 销售出库单查询列表
        [Route("Kf_SellOutBill/QueryList")]
        [HttpGet]
        public object QueryList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBillQuery", 1, false, user))
                {
                    objJsonResult.code = CodeConstant.FAIL;
                    objJsonResult.count = CountConstant.FAIL;
                    objJsonResult.Message = "无权限查看!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = "select * from h_v_Kf_SellOutBillQuery where 1 = 1 ";
                if (sWhere == "" || sWhere == null)
                {
                    ds = oCN.RunProcReturn("select * from h_v_Kf_SellOutBillQuery  order by hmainid desc", "h_v_Kf_SellOutBillQuery");
                }
                else
                {
                    ds = oCN.RunProcReturn(sql + sWhere + " order by hmainid desc", "h_v_Kf_SellOutBillQuery");
                }
                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 = CodeConstant.SUCCEED;
                objJsonResult.count = CountConstant.SUCCEED;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = CodeConstant.FAIL;
                objJsonResult.count = CountConstant.FAIL;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 销售出库单查询子列表
        [Route("Kf_SellOutBill/QuerySubList")]
        [HttpGet]
        public object QuerySubList(string hmainid, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBillQuery", 1, false, user))
                {
                    objJsonResult.code = CodeConstant.FAIL;
                    objJsonResult.count = CountConstant.FAIL;
                    objJsonResult.Message = "无权限查看!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = "select * from h_v_Kf_SellOutBillQuerySub where hmainid =  " + hmainid;
                ds = oCN.RunProcReturn(sql + " order by hsubid desc", "h_v_Kf_SellOutBillQuerySub");
                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 = CodeConstant.SUCCEED;
                objJsonResult.count = CountConstant.SUCCEED;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = CodeConstant.FAIL;
                objJsonResult.count = CountConstant.FAIL;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 销售出库单 判断是否具备查看金额权限
        [Route("Kf_SellOutBill/CheckRight_Money")]
        [HttpGet]
        public object CheckRight_Money(string user)
        {
            try
            {
                //判断查询权限
                if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBill_Money", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                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
    }
}