using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers
{
public class Gy_BadReasonController : ApiController
{
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
///
/// 返回不良原因列表
///参数:string sql。
///返回值:object。
///
[Route("Gy_BadReason/list")]
[HttpGet]
public object list(string sWhere,string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadReason", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn("select * from h_v_IF_BadReasonList " + sWhere+ " order by 不良原因代码 ", "h_v_IF_BadReasonList");
}
else
{
string sql1 = "select * from h_v_IF_BadReasonList where 1 = 1";
string sql = sql1 + sWhere+ " order by 不良原因代码 ";
ds = oCN.RunProcReturn(sql, "h_v_IF_BadReasonList");
}
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
//if (ds.Tables[0].Rows.Count != 0 || ds != null)
//{
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
//}
//else
//{
//objJsonResult.code = "0";
//objJsonResult.count = 0;
//objJsonResult.Message = "无数据";
//objJsonResult.data = null;
//return objJsonResult;
//}
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#region 不良原因审核、反审核
///
///
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_BadReason")]
[HttpGet]
public object AuditGy_BadReason(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_BadReason set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_BadReason set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良原因禁用、反禁用
///
///
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_BadReason")]
[HttpGet]
public object StopGy_BadReason(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Stop", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_BadReason set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_BadReason set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良类型 查询
[Route("Gy_BadReason/Gy_BadTypeList")]
[HttpGet]
public object Gy_BadTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadType_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_gy_BadTypeList where 1 = 1";
string sql = sql1 + sWhere + " order by 不良类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_gy_BadTypeList");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良后果 查询,审核,反审核,禁用,反禁用
///
/// 不良后果 查询
///
///
///
///
[Route("Gy_BadReason/Gy_BadResultList")]
[HttpGet]
public object Gy_BadResultList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadResult_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_BadResult where 1 = 1";
string sql = sql1 + sWhere + " order by 不良后果代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_BadResult");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 不良后果审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_BadResult")]
[HttpGet]
public object AuditGy_BadResult(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadResult_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadResult where HItemID=" + HInterID, "Gy_BadResult");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_BadResult set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_BadResult set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 不良后果禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_BadResult")]
[HttpGet]
public object StopGy_BadResult(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadResult_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadResult where HItemID=" + HInterID, "Gy_BadResult");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_BadResult set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_BadResult set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检测值 查询,审核,反审核,禁用,反禁用
///
/// 检测值 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectValueList")]
[HttpGet]
public object Gy_InspectValueList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectValue_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectValue where 1 = 1";
string sql = sql1 + sWhere + " order by 检测值代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectValue");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检测值审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectValue")]
[HttpGet]
public object AuditGy_InspectValue(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectValue_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectValue where HItemID=" + HInterID, "Gy_InspectValue");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectValue set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectValue set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检测值禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectValue")]
[HttpGet]
public object StopGy_InspectValue(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectValue_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectValue where HItemID=" + HInterID, "Gy_InspectValue");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectValue set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectValue set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检验方法 查询,审核,反审核,禁用,反禁用
///
/// 检验方法 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectMethodList")]
[HttpGet]
public object Gy_InspectMethodList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectMethod_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectMethod where 1 = 1";
string sql = sql1 + sWhere + " order by 检验方法代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectMethod");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验方法审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectMethod")]
[HttpGet]
public object AuditGy_InspectMethod(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectMethod set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectMethod set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验方法禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectMethod")]
[HttpGet]
public object StopGy_InspectMethod(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectMethod set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectMethod set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 质量标准 查询,审核,反审核,禁用,反禁用
///
/// 质量标准 查询
///
///
///
///
[Route("Gy_BadReason/Gy_QualityStdList")]
[HttpGet]
public object Gy_QualityStdList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_QualityStd_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_QualityStd where 1 = 1";
string sql = sql1 + sWhere + " order by 质量标准代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_QualityStd");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 质量标准 审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_QualityStd")]
[HttpGet]
public object AuditGy_QualityStd(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_QualityStd_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_QualityStd where HItemID=" + HInterID, "Gy_QualityStd");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_QualityStd set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_QualityStd set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 质量标准禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_QualityStd")]
[HttpGet]
public object StopGy_QualityStd(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_QualityStd_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_QualityStd where HItemID=" + HInterID, "Gy_QualityStd");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_QualityStd set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_QualityStd set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检验仪器 查询,审核,反审核,禁用,反禁用
///
/// 检验仪器 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectInstruMentList")]
[HttpGet]
public object Gy_InspectInstruMentList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectInstruMent_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectInstruMent where 1 = 1";
string sql = sql1 + sWhere + " order by 检验仪器代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectInstruMent");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验仪器 审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectInstruMent")]
[HttpGet]
public object AuditGy_InspectInstruMent(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectInstruMent_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectInstruMent where HItemID=" + HInterID, "Gy_InspectInstruMent");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验仪器 禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectInstruMent")]
[HttpGet]
public object StopGy_InspectInstruMent(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectInstruMent_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectInstruMent where HItemID=" + HInterID, "Gy_InspectInstruMent");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检验依据 查询,审核,反审核,禁用,反禁用
///
/// 检验依据 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectBasisList")]
[HttpGet]
public object Gy_InspectBasisList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectBasis_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectBasis where 1 = 1";
string sql = sql1 + sWhere + " order by 检验依据代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectInstruMent");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验依据 审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectBasis")]
[HttpGet]
public object AuditGy_InspectBasis(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectBasis_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectBasis where HItemID=" + HInterID, "Gy_InspectBasis");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectBasis set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectBasis set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验依据 禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectBasis")]
[HttpGet]
public object StopGy_InspectBasis(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectBasis_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectBasis where HItemID=" + HInterID, "Gy_InspectBasis");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectBasis set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectBasis set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
}
}