using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
using System.Web.Http;
using WebAPI.Models;
using SyntacticSugar.constant;
using Newtonsoft.Json;
namespace WebAPI.Controllers
{
/**
* 找货单单
*/
public class Sc_MouldProdMoveBillListController : ApiController
{
public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
private json objJsonResult = new json();
public DataSet ds = new DataSet();
public WebServer webserver = new WebServer();
public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类
public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类
///
/// 根据包装单 返回此包装单内的相关信息
///
///
///
/// 检具维修工单列表
///
///
[Route("Sc_CheckToolsRepair/GetCheckToolsRepairWorkBillList")]
[HttpGet]
public object GetCheckToolsRepairWorkBillList(string sWhere)
{
try
{
ds = Sc_CheckToolsRepairWorkBillList_s(sWhere);
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 = "1";
objJsonResult.count = 1;
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;
}
}
#region sql语句
public static DataSet Sc_CheckToolsRepairWorkBillList_s(string sWhere)
{
return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_CheckToolsRepairWorkBillList ", "h_v_Sc_CheckToolsRepairWorkBillList");
}
#region 器具直接调拨单
#region 器具直接调拨单列表
[Route("Sc_MouldProdMoveBill/GetMouldProdMoveBill")]
[HttpGet]
public object GetMouldProdMoveBill(string sWhere,string user, string Organization)
{
try
{
//编辑权限
if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldProdMoveBillList", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
ds = Sc_GetMouldProdMoveBill(sWhere,Organization);
objJsonResult.code = "1";
objJsonResult.count = 1;
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_GetMouldProdMoveBill(string sWhere, string Organization)
{
string sql1 = string.Format(@"select * from h_v_Sc_MouldProdMoveBillList where (调入组织='" + Organization + "' or 调出组织='" + Organization + "')");
if (sWhere == null || sWhere.Equals(""))
{
return new SQLHelper.ClsCN().RunProcReturn(sql1+ "order by 制单日期 desc", "h_v_Sc_MouldProdMoveBillList");
}
else
{
string sql = sql1 + sWhere+ "order by 制单日期 desc";
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdMoveBillList");
}
}
#endregion
#region 器具直接调拨单分页列表
[Route("Sc_MouldProdMoveBill/page")]
[HttpGet]
public object Sc_MouldProdMoveBillPage(string sWhere, string user, int page, int size)
{
DataSet ds;
try
{
List