using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
using WebAPI.Models;
|
|
namespace WebAPI.Controllers.SBGL
|
{
|
public class Sb_EquipDotCheckRuleBillController : ApiController
|
{
|
private json objJsonResult = new json();
|
public DataSet ds = new DataSet();
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
public DLL.ClsSb_EquipDotCheckRuleBill BillNew = new DLL.ClsSb_EquipDotCheckRuleBill(); //对应单据类
|
public DLL.ClsSb_EquipDotCheckRuleBill BillOld = new DLL.ClsSb_EquipDotCheckRuleBill(); //对应单据类
|
|
|
#region 设备点检规程单列表
|
[Route("Sb_EquipDotCheckRuleBill/GetEquipDotCheckRuleList")]
|
[HttpGet]
|
public object GetEquipDotCheckRuleList(string sWhere)
|
{
|
try
|
{
|
if (sWhere == null || sWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select * from h_v_Sb_EquipDotCheckRuleList " + sWhere + " order by hmainid desc", "h_v_Sb_EquipDotCheckRuleList");
|
}
|
else
|
{
|
string sql1 = "select * from h_v_Sb_EquipDotCheckRuleList where 1 = 1";
|
string sql = sql1 + sWhere + " order by hmainid desc";
|
ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList");
|
}
|
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;
|
}
|
}
|
#endregion
|
|
#region 设备点检规程记录删除功能
|
[Route("Sb_EquipDotCheckRuleBill/DeleteEquipDotCheckRuleBillList")]
|
[HttpGet]
|
public object DeleteEquipDotCheckRuleBillList(string HInterID)
|
{
|
Int64 lngBillKey = 0;
|
lngBillKey = DBUtility.ClsPub.isLong(HInterID);
|
if (lngBillKey == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据ID为空!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill();
|
if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
|
{
|
if (oBill.omodel.HBillStatus > 1)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
if (oBill.omodel.HChecker != "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已经审核,不能删除!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (IsDete)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据未找到";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region[设备点检规程单编辑时获取表头数据]
|
[Route("Sb_EquipDotCheckRuleBill/Sb_EquipDotCheckRuleBillListCheckDetai")]
|
[HttpGet]
|
public ApiResult<DataSet> Sb_EquipDotCheckRuleBillListCheckDetai(string HID)
|
{
|
if (string.IsNullOrEmpty(HID))
|
return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipDotCheckRuleList where hmainid= " + HID + " ", "h_v_Sb_EquipDotCheckRuleList");
|
if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
|
return new ApiResult<DataSet> { code = -1, msg = "不存在点检规程表" };
|
return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
|
}
|
#endregion
|
|
#region[设备点检规程单编辑时获取表体数据]
|
[Route("Sb_EquipDotCheckRuleBill/Sb_EquipDotCheckRuleBillListProjectDetai")]
|
[HttpGet]
|
public object Sb_EquipDotCheckRuleBillListProjectDetai(string sqlWhere)
|
{
|
DataSet ds;
|
try
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
if (sqlWhere == null || sqlWhere.Equals(""))
|
{
|
ds = oCN.RunProcReturn("select 点检项目ID,点检项目,点检部位,具体要求,负责人ID,负责人代码,负责人,子备注 from h_v_Sb_EquipDotCheckRuleList", "h_v_Sb_EquipDotCheckRuleList");
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "获取信息成功!";
|
objJsonResult.data = ds.Tables[0];
|
}
|
else
|
{
|
string sql1 = "select 点检项目ID,点检项目,点检部位,具体要求,负责人ID,负责人代码,负责人,子备注 from h_v_Sb_EquipDotCheckRuleList where 1 = 1 ";
|
string sql = sql1 + sqlWhere;
|
ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList");
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "获取信息成功!";
|
objJsonResult.data = ds.Tables[0];
|
}
|
}
|
catch (Exception e)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有返回任何记录!" + e.ToString();
|
objJsonResult.data = null;
|
}
|
return objJsonResult;
|
}
|
#endregion
|
}
|
}
|