using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.Http;
|
using WebAPI.Models;
|
using WebAPI.Service;
|
using System.Collections.Generic;
|
using System.Data;
|
using Newtonsoft.Json.Linq;
|
|
namespace WebAPI.Controllers
|
{
|
public class QC_ManagementController : ApiController
|
{
|
|
#region 错误返回方法
|
// GET: QC_Management
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
|
|
private json objJsonResult = new json();
|
|
///<summary>
|
///封装状态码及返回信息的公用方法。
|
///参数:DataSet。
|
///返回值:json。
|
///</summary>
|
public object GetObjectJson(DataSet ds)
|
{
|
try
|
{
|
if (ds == null || ds.Tables[0].Rows.Count <= 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "获取信息成功!";
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
|
///<summary>
|
///统一正确信息方法。
|
///参数:string。
|
///返回值:object。
|
///</summary>
|
public object CustomCorrect(DataSet ds)
|
{
|
if (ds == null || ds.Tables[0].Rows.Count <= 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "获取信息成功!";
|
objJsonResult.data = ds.Tables[0];
|
return objJsonResult;
|
}
|
}
|
|
///<summary>
|
///自定义错误信息方法。
|
///参数:string。
|
///返回值:object。
|
///</summary>
|
public object CustomError(string msg)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = msg;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
#endregion
|
/// <summary>
|
/// 返回检验方案单列表
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
[Route("QC_Management/MES_QC_CheckProjectList_Json")]
|
[HttpGet]
|
public object MES_QC_CheckProjectList_Json(string sqlWhere)
|
{
|
DataSet ds;
|
try
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
if (sqlWhere == null || sqlWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select top 500 * from h_v_Gy_QCCheckProjectList ", "h_v_Gy_QCCheckProjectList");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1 = 1 ";
|
string sql = sql1 + sqlWhere;
|
ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList");
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
return GetObjectJson(ds);
|
}
|
|
/// <summary>
|
/// 返回来料检验单列表
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
[Route("QC_Management/MES_QC_POStockInCheckBillList_Json")]
|
[HttpGet]
|
public object MES_QC_POStockInCheckBillList_Json(string sqlWhere)
|
{
|
DataSet ds;
|
try
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
if (sqlWhere == null || sqlWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select top 500 * from h_v_QC_POStockInCheckBillList ", "h_v_QC_POStockInCheckBillList");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_QC_POStockInCheckBillList where 1 = 1 ";
|
string sql = sql1 + sqlWhere;
|
ds = oCN.RunProcReturn(sql, "h_v_QC_POStockInCheckBillList");
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
return GetObjectJson(ds);
|
}
|
|
/// <summary>
|
///返回首件检验单列表
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
[Route("QC_Management/MES_QC_FirstPieceCheckBillList_Json")]
|
[HttpGet]
|
public object MES_QC_FirstPieceCheckBillList_Json(string sqlWhere)
|
{
|
DataSet ds;
|
try
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
if (sqlWhere == null || sqlWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select top 500 * from h_v_QC_FirstPieceCheckBillList ", "h_v_QC_FirstPieceCheckBillList");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_QC_FirstPieceCheckBillList where 1 = 1 ";
|
string sql = sql1 + sqlWhere;
|
ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBillList");
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
return GetObjectJson(ds);
|
}
|
|
/// <summary>
|
/// 返回巡检记录单列表
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
[Route("QC_Management/MES_QC_PatrolProcCheckBillList_Json")]
|
[HttpGet]
|
public object MES_QC_PatrolProcCheckBillList_Json(string sqlWhere)
|
{
|
DataSet ds;
|
try
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
if (sqlWhere == null || sqlWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select top 500 * from h_v_QC_PatrolProcCheckBillList ", "h_v_QC_PatrolProcCheckBillList");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 1 = 1 ";
|
string sql = sql1 + sqlWhere;
|
ds = oCN.RunProcReturn(sql, "h_v_QC_PatrolProcCheckBillList");
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
return GetObjectJson(ds);
|
}
|
|
|
|
}
|
}
|