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 PurchaseOrderController : ApiController
|
{
|
private json objJsonResult = new json();
|
public DataSet ds = new DataSet();
|
public WebServer webserver = new WebServer();
|
|
#region 采购订单列表
|
|
[Route("Cg_PurchaseOrder/GetPurchaseOrderBill")]
|
[HttpGet]
|
public object GetPurchaseOrderBill(int page, int limit, string sWhere)
|
{
|
try
|
{
|
int count = 0;
|
int pageNum = page;
|
int pageSize = limit;
|
ds = Sc_GetPurchaseOrderBill(sWhere, pageNum, pageSize, out count);
|
objJsonResult.code = "1";
|
objJsonResult.count = count;
|
objJsonResult.Message = "返回记录成功!";
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
catch (Exception ex)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
public static DataSet Sc_GetPurchaseOrderBill(string sWhere,int pageNum, int pageSize, out int count)
|
{
|
if (sWhere == null || sWhere.Equals(""))
|
{
|
sWhere = "where isnull(关闭人,'')='' and isnull(行关闭人,'')=''";
|
}
|
else
|
{
|
string Search = " where isnull(关闭人,'')='' and isnull(行关闭人,'')='' ";
|
sWhere = Search+sWhere;
|
}
|
count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldConkBookBillList " + sWhere, "h_v_Sc_MouldConkBookBillList").Tables[0].Rows.Count;
|
string sql = string.Format(@"select top "+ pageSize + " * from(select row_number() over (order by 单据号 desc) as RowNumber,* from h_v_Sc_MouldConkBookBillList " + sWhere+") as A where RowNumber >"+ pageSize + " *("+ pageNum + "-1)");
|
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldConkBookBillList");
|
}
|
#endregion
|
}
|
}
|