using DBUtility;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WebAPI.Code;
using WebAPI.Models;
namespace WebAPI.Controllers
{
public class ReportController : ApiController
{
private JsonResult objJsonResult = new JsonResult();
private json objjson = new json();
///
/// 采购订单跟踪表
///
///
///
///
///
[Route("GetPOOrderBillProcReport")]
[HttpGet]
//采购订单跟踪表
public object GetPOOrderBillProcReport(string HSupNo, string sqlWhere)
{
string msg = "";
try
{
string VsWhere = "";
string PcWhere = "";
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
DataSet ds;
//其他过滤
if (msg.Trim() == "")
{
msg = " Where hsupid in (select HSupID from h_v_Gy_UserSupplierList where 用户=^^" + HSupNo.Trim() + "^^) " + sqlWhere;
}
else
{
msg = msg + " and hsupid in (select HSupID from h_v_Gy_UserSupplierList where 用户=^^" + HSupNo.Trim() + "^^) " + sqlWhere;
}
//转换特殊字符
if (Common.SQLtoChange(msg, ref VsWhere, ref PcWhere) == false)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败";
objjson.data = null;
return objjson;
}
//获取总行数
Int64 RowTotal = Common.GetRowTotal("h_v_SRM_POOrderBillProcReport", VsWhere, ref DBUtility.ClsPub.sExeReturnInfo);
//获取返回数据
ds = oCn.RunProcReturn("exec h_p_SRM_POOrderBillProcReport '" + PcWhere + "'", "h_p_SRM_POOrderBillProcReport");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败";
objjson.data = null;
return objjson;
}
else
{
objjson.code = "0";
objjson.count = 10000;
objjson.Message = "获取成功";
objjson.data = ds.Tables[0];
return objjson;
}
}
catch (Exception e)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败" + e.ToString();
objjson.data = null;
return objjson;
}
}
///
/// 委外订单跟踪表
///
///
///
///
///
[Route("GetEntrustBillProcReport")]
[HttpGet]
//委外订单跟踪表
public object GetEntrustBillProcReport(string HSupNo, string sqlWhere)
{
string msg = "";
try
{
string VsWhere = "";
string PcWhere = "";
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
DataSet ds;
//其他过滤
if (msg.Trim() == "")
{
msg = " Where hsupid in (select HSupID from h_v_Gy_UserSupplierList where 用户=^^" + HSupNo.Trim() + "^^) " + sqlWhere;
}
else
{
msg = msg + " and hsupid in (select HSupID from h_v_Gy_UserSupplierList where 用户=^^" + HSupNo.Trim() + "^^) " + sqlWhere;
}
//转换特殊字符
if (Common.SQLtoChange(msg, ref VsWhere, ref PcWhere) == false)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败";
objjson.data = null;
return objjson;
}
//获取总行数
Int64 RowTotal = Common.GetRowTotal("h_v_SRM_EntrustBillProcReport", VsWhere, ref DBUtility.ClsPub.sExeReturnInfo);
//获取返回数据
ds = oCn.RunProcReturn("exec h_p_SRM_EntrustBillProcReport '" + PcWhere + "'", "h_p_SRM_EntrustBillProcReport");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败";
objjson.data = null;
return objjson;
}
else
{
objjson.code = "0";
objjson.count = 10000;
objjson.Message = "获取成功";
objjson.data = ds.Tables[0];
return objjson;
}
}
catch (Exception e)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败" + e.ToString();
objjson.data = null;
return objjson;
}
}
///
/// 送货单跟踪表
///
///
///
///
///
[Route("GetSendGoodsProcReport")]
[HttpGet]
//送货单跟踪表
public object GetSendGoodsProcReport(string HSupNo, string sqlWhere)
{
string msg = "";
try
{
string VsWhere = "";
string PcWhere = "";
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
DataSet ds;
//其他过滤
if (msg.Trim() == "")
{
msg = " Where hsupid in (select HSupID from h_v_Gy_UserSupplierList where 用户=^^" + HSupNo.Trim() + "^^) " + sqlWhere;
}
else
{
msg = msg + " and hsupid in (select HSupID from h_v_Gy_UserSupplierList where 用户=^^" + HSupNo.Trim() + "^^) " + sqlWhere;
}
//转换特殊字符
if (Common.SQLtoChange(msg, ref VsWhere, ref PcWhere) == false)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败";
objjson.data = null;
return objjson;
}
//获取总行数
Int64 RowTotal = Common.GetRowTotal("h_v_SRM_SendGoodsProcReport", VsWhere, ref DBUtility.ClsPub.sExeReturnInfo);
//获取返回数据
ds = oCn.RunProcReturn("exec h_p_SRM_SendGoodsProcReport '" + PcWhere + "'", "h_p_SRM_POOrderBillProcReport");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败";
objjson.data = null;
return objjson;
}
else
{
objjson.code = "0";
objjson.count = 10000;
objjson.Message = "获取成功";
objjson.data = ds.Tables[0];
return objjson;
}
}
catch (Exception e)
{
objjson.code = "0";
objjson.count = 0;
objjson.Message = "获取失败" + e.ToString();
objjson.data = null;
return objjson;
}
}
}
}