using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers
{
/**
* 找货单单
*/
public class Sc_CheckToolsRepairWorkBillListController : ApiController
{
public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
private json objJsonResult = new json();
public DataSet ds = new DataSet();
public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
public WebServer webserver = new WebServer();
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(); //模具报废入库对应单据类
public DLL.ClsSc_MouldRepairInBill BillNew01 = new DLL.ClsSc_MouldRepairInBill(); //模具改制入库对应单据类
public DLL.ClsSc_MouldRepairInBill BillOld01 = new DLL.ClsSc_MouldRepairInBill(); //模具改制入库对应单据类
///
/// 根据包装单 返回此包装单内的相关信息
///
///
///
/// 检具维修工单列表
///
///
[Route("Sc_CheckToolsRepairWorkBillList/GetCheckToolsRepairWorkBillList")]
[HttpGet]
public object GetCheckToolsRepairWorkBillList(string sWhere)
{
try
{
ds = Sc_CheckToolsRepairWorkBillList(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(string sWhere)
{
return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldRepairInBillList ", "h_v_Sc_MouldRepairInBillList");
}
#region 器具改制入库单
#region 器具改制入库单据维护列表
[Route("Sc_CheckToolsRepairWorkBillList/GetMouldRepairInBillList")]
[HttpGet]
public object GetMouldRepairInBillList(string sWhere,string user, string Organization)
{
try
{
//编辑权限
if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairIn_SingleBillList", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
ds = Sc_MouldRepairInBillList(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_MouldRepairInBillList(string sWhere,string Organization)
{
string sql1 = string.Format(@"select * from h_v_Sc_MouldRepairInBillList where 库存组织='" + Organization + "'");
if (sWhere == null || sWhere.Equals(""))
{
return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by 制单日期 desc", "h_v_Sc_MouldRepairInBillList");
}
else
{
string sql = sql1 + sWhere+ "order by 制单日期 desc";
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldRepairInBillList");
}
}
#endregion
#region[器具改制入库单编辑时获取表体数据]
[Route("Sc_MouldRepairInBill/Sc_MouldRepairInBillListCheckDetai")]
[HttpGet]
public object Sc_MouldRepairInBillListCheckDetai(string sqlWhere)
{
DataSet ds;
DataSet ds1;
List