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_MouldOtherOutBillController : 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();
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_MouldOtherOutBill/GetMouldOtherOutBill")]
[HttpGet]
public object GetMouldOtherOutBill(string sWhere,string user, string Organization)
{
try
{
//编辑权限
if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldOtherOutBillList", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
ds = Sc_MouldOtherOutBill(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_MouldOtherOutBill(string sWhere, string Organization)
{
string sql1 = string.Format(@"select * from h_v_Sc_MouldOtherOutBillList where 库存组织='" + Organization + "'");
if (sWhere == null || sWhere.Equals(""))
{
return new SQLHelper.ClsCN().RunProcReturn(sql1+ "order by 制单日期 desc", "h_v_Sc_MouldOtherOutBillList");
}
else
{
string sql = sql1 + sWhere+ "order by 制单日期 desc";
return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldOtherOutBillList");
}
}
#endregion
#region[其他出库单编辑时获取表头数据]
[Route("Sc_MouldOtherOutBill/Sc_MouldOtherOutBillListCheckDetai")]
[HttpGet]
public ApiResult Sc_MouldOtherOutBillListCheckDetai(string HID)
{
if (string.IsNullOrEmpty(HID))
return new ApiResult { code = -1, msg = "ID不能为空" };
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldOtherOutBillList where hmainid= " + HID + " ", "h_v_Sc_MouldOtherOutBillList");
if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
return new ApiResult { code = -1, msg = "不存在退库单号" };
return new ApiResult { code = 1, msg = "查询成功", data = dataSet };
}
#endregion
#region[其他出库单编辑时获取表体数据]
[Route("Sc_MouldOtherOutBill/Sc_MouldOtherOutBillListProjectDetai")]
[HttpGet]
public object Sc_MouldOtherOutBillListProjectDetai(string sqlWhere)
{
DataSet ds;
DataSet ds1;
List