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.IO;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.Controllers.SCGL.日计划管理;
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;
#region 不良原因 查询,审核,反审核,禁用,反禁用
///
/// 返回不良原因列表
///
[Route("Gy_BadReason/list")]
[HttpGet]
public object list(string sWhere,string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadReason_Query", 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+ " ", "h_v_IF_BadReasonList");
}
else
{
string sql1 = "select * from h_v_IF_BadReasonList where 1 = 1";
string sql = sql1 + sWhere;
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_BadReason_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadReason set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_BadReason_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_BadReason_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadReason set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_BadReason_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadReason_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadReason set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadReason_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadReason_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadReason set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadReason_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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
#endregion
#region 不良类型 查询
#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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_BadResult_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadResult set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_BadResult_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_BadResult_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadResult set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_BadResult_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadResult_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadResult set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadResult_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadResult_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadResult set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadResult_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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) //审核判断
{
//审核前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeCheckCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectValue set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterCheckCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeUnCheckCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectValue set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterUnCheckCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
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) //禁用判断
{
//禁用前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeStopCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectValue set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterStopCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeUnStopCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectValue set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterUnStopCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
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;
}
}
#region 校验项目列表 文件上传
[Route("Gy_InspectMethod/Gy_Process_Excel")]
[HttpPost]
public json Gy_InspectMethod_Excel()
{
json res = new json();
try
{
//获取文件名称
var file = HttpContext.Current.Request.Files[0];
//获取文件物理路径
string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
//保存文件
file.SaveAs(ExcelPath);
NpoiHelper np = new NpoiHelper();
DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
//删除文件
File.Delete(ExcelPath);
//创建临时表
DataTable provisional = new DataTable("dt2");
//添加列名
for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
{
provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
}
//添加数据
for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
{
DataRow row = provisional.NewRow();
for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
{
row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
}
provisional.Rows.Add(row);
}
//判断列
string error = JudgmentGy_InspectMethodColumns(provisional);
if (error.Length > 0)
{
res.code = "0";
res.count = 0;
res.Message = $"Excel模板存在错误,{error}\r\n";
res.data = null;
return res;
}
for (int i = 0; i <= provisional.Rows.Count - 1; i++)
{
string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验方法代码"].ToString());
string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验方法名称"].ToString());
string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["助记码"]);
string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString());
//获取真实行数
int line = i + 1;
}
res.code = "1";
res.count = 1;
res.Message = error;
res.data = provisional;
return res;
}
catch (Exception e)
{
res.code = "0";
res.count = 0;
res.Message = "Exception!" + e.ToString();
res.data = null;
return res;
}
}
///
/// 判断检验方法列
///
///
///
private static string JudgmentGy_InspectMethodColumns(DataTable provisional)
{
var error = "";
//查询没有的列
if (!provisional.Columns.Contains("检验方法代码"))
error += "没有找到【检验方法代码】的标题,";
if (!provisional.Columns.Contains("检验方法名称"))
error += "没有找到【检验方法名称】的标题,";
return error;
}
#endregion
#region 检验方法列表 导入(保存)
[Route("Gy_InspectMethod/Gy_Process_btnSave")]
[HttpPost]
public object Gy_InspectMethod_btnSave([FromBody] JObject sMainSub)
{
var _value = sMainSub["sMainSub"].ToString();
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { "&和" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();
string user = sArray[1].ToString();
string organ = sArray[2].ToString();
try
{
if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无保存权限!";
objJsonResult.data = null;
return objJsonResult;
}
List Excel = Newtonsoft.Json.JsonConvert.DeserializeObject>(msg2);
List> list = new List>();
foreach (JObject item in Excel)
{
Dictionary dic = new Dictionary();
foreach (var itm in item.Properties())
{
dic.Add(itm.Name, itm.Value.ToString());
}
list.Add(dic);
}
oCN.BeginTran();
int i = 1;
foreach (Dictionary item in list)
{
string HNumber = item["检验方法代码"].ToString();
string HName = item["检验方法名称"].ToString();
string HHelpCode = item["助记码"];
string HRemark = item["备注"].ToString();
string sShortNumber;
sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//短代码
if (sShortNumber.Trim() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "保存失败!短代码为空!";
objJsonResult.data = 1;
return objJsonResult;
}
int HEndFlag = 1;//末级标志
int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //等级
if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
objJsonResult.data = 1;
return objJsonResult;
}
ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HNumber='" + HNumber + "'", "Gy_InspectMethod");
if (ds.Tables[0].Rows.Count == 0)
{
string sql = "insert into Gy_InspectMethod (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HMakeTime,HMakeEmp)" +
$"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '未使用', '{organ}', '{organ}', '{System.DateTime.Now.ToString("G")}', '{user}')";
oCN.RunProc(sql);
}
else
{
oCN.RunProc("update Gy_InspectMethod set HName='" + HName + "', HHelpCode= '" + HHelpCode + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "' where HNumber= '" + HNumber + "'");
}
i++;
}
oCN.Commit();
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "导入成功!";
objJsonResult.data = null;
return objJsonResult;
}
catch (Exception e)
{
LogService.Write(e);
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#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_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;
}
}
///
/// 不良类型 审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_BadType")]
[HttpGet]
public object AuditGy_BadType(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadType_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadType where HItemID=" + HInterID, "Gy_BadType");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_BadType_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_BadType_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_BadType_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_BadType_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_BadType")]
[HttpGet]
public object StopGy_BadType(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadType_Stop", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadType where HItemID=" + HInterID, "Gy_BadType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadType_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadType_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadType_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadType_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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) //审核判断
{
//审核前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeCheckCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterCheckCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeUnCheckCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterUnCheckCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
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) //禁用判断
{
//禁用前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeStopCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterStopCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeUnStopCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterUnStopCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
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_InspectBasis");
//添加列名
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
#region 岗位技能 查询,审核,反审核,禁用,反禁用
///
/// 岗位技能 查询
///
///
///
///
[Route("Gy_BadReason/Gy_PostSkillList")]
[HttpGet]
public object Gy_PostSkillList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_PostSkill_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_PostSkill where 1 = 1";
string sql = sql1 + sWhere + " order by 岗位技能代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_PostSkill");
//添加列名
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_PostSkill")]
[HttpGet]
public object AuditGy_PostSkill(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PostSkill_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PostSkill where HItemID=" + HInterID, "Gy_PostSkill");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_PostSkill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PostSkill set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_PostSkill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_PostSkill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PostSkill set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_PostSkill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_PostSkill")]
[HttpGet]
public object StopGy_PostSkill(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PostSkill_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PostSkill where HItemID=" + HInterID, "Gy_PostSkill");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_PostSkill_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PostSkill set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_PostSkill_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_PostSkill_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PostSkill set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_PostSkill_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_PostList")]
[HttpGet]
public object Gy_PostList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_Post_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_Post where 1 = 1";
string sql = sql1 + sWhere + " order by 岗位代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_Post");
//添加列名
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_Post")]
[HttpGet]
public object AuditGy_Post(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_Post_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_Post where HItemID=" + HInterID, "Gy_Post");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_Post_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_Post set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_Post_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_Post_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_Post set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_Post_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_Post")]
[HttpGet]
public object StopGy_Post(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_Post_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_Post where HItemID=" + HInterID, "Gy_Post");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_Post_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_Post set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_Post_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_Post_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_Post set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_Post_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_StockMoveStyleList")]
[HttpGet]
public object Gy_StockMoveStyleList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_StockMoveStyle_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_StockMoveStyle where 1 = 1";
string sql = sql1 + sWhere + " order by 调拨类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_StockMoveStyle");
//添加列名
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_StockMoveStyle")]
[HttpGet]
public object AuditGy_StockMoveStyle(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockMoveStyle_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockMoveStyle where HItemID=" + HInterID, "Gy_StockMoveStyle");
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_StockMoveStyle 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_StockMoveStyle 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_StockMoveStyle")]
[HttpGet]
public object StopGy_StockMoveStyle(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockMoveStyle_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockMoveStyle where HItemID=" + HInterID, "Gy_StockMoveStyle");
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_StockMoveStyle 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_StockMoveStyle 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_StockInStyleList")]
[HttpGet]
public object Gy_StockInStyleList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_StockInStyle_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_StockInStyle where 1 = 1";
string sql = sql1 + sWhere + " order by 入库类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_StockInStyle");
//添加列名
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_StockInStyle")]
[HttpGet]
public object AuditGy_StockInStyle(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockInStyle_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockInStyle where HItemID=" + HInterID, "Gy_StockInStyle");
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_StockInStyle 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_StockInStyle 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_StockInStyle")]
[HttpGet]
public object StopGy_StockInStyle(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockInStyle_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockInStyle where HItemID=" + HInterID, "Gy_StockInStyle");
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_StockInStyle 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_StockInStyle 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_StockOutStyleList")]
[HttpGet]
public object Gy_StockOutStyleList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_StockOutStyle_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_StockOutStyle where 1 = 1";
string sql = sql1 + sWhere + " order by 出库类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_StockOutStyle");
//添加列名
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_StockOutStyle")]
[HttpGet]
public object AuditGy_StockOutStyle(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockOutStyle_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockOutStyle where HItemID=" + HInterID, "Gy_StockOutStyle");
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_StockOutStyle 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_StockOutStyle 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_StockOutStyle")]
[HttpGet]
public object StopGy_StockOutStyle(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockOutStyle_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockOutStyle where HItemID=" + HInterID, "Gy_StockOutStyle");
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_StockOutStyle 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_StockOutStyle 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_AreaSetList")]
[HttpGet]
public object Gy_AreaSetList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_AreaSet_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_AreaSet where 1 = 1";
string sql = sql1 + sWhere + " order by 地区代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_AreaSet");
//添加列名
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_AreaSet")]
[HttpGet]
public object AuditGy_AreaSet(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_AreaSet_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_AreaSet where HItemID=" + HInterID, "Gy_AreaSet");
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_AreaSet 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_AreaSet 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_AreaSet")]
[HttpGet]
public object StopGy_AreaSet(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_AreaSet_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_AreaSet where HItemID=" + HInterID, "Gy_AreaSet");
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_AreaSet 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_AreaSet 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_SellStyleList")]
[HttpGet]
public object Gy_SellStyleList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_SellStyle_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_SellStyle where 1 = 1";
string sql = sql1 + sWhere + " order by 销售方式代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_SellStyle");
//添加列名
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_SellStyle")]
[HttpGet]
public object AuditGy_SellStyle(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_SellStyle_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_SellStyle where HItemID=" + HInterID, "Gy_SellStyle");
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_SellStyle 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_SellStyle 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_SellStyle")]
[HttpGet]
public object StopGy_SellStyle(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_SellStyle_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_SellStyle where HItemID=" + HInterID, "Gy_SellStyle");
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_SellStyle 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_SellStyle 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_PoStockStyleList")]
[HttpGet]
public object Gy_PoStockStyleList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_PoStockStyle_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_PoStockStyle where 1 = 1";
string sql = sql1 + sWhere + " order by 采购方式代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_PoStockStyle");
//添加列名
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_PoStockStyle")]
[HttpGet]
public object AuditGy_PoStockStyle(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PoStockStyle_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PoStockStyle where HItemID=" + HInterID, "Gy_PoStockStyle");
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_PoStockStyle 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_PoStockStyle 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_PoStockStyle")]
[HttpGet]
public object StopGy_PoStockStyle(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PoStockStyle_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PoStockStyle where HItemID=" + HInterID, "Gy_PoStockStyle");
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_PoStockStyle 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_PoStockStyle 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_SupTypeList")]
[HttpGet]
public object Gy_SupTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_SupType_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_SupType where 1 = 1";
string sql = sql1 + sWhere + " order by 供应商分类代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_SupType");
//添加列名
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_SupType")]
[HttpGet]
public object AuditGy_SupType(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_SupType_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_SupType where HItemID=" + HInterID, "Gy_SupType");
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_SupType 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_SupType 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_SupType")]
[HttpGet]
public object StopGy_SupType(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_SupType_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_SupType where HItemID=" + HInterID, "Gy_SupType");
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_SupType 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_SupType 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_TechnologyTypeList")]
[HttpGet]
public object Gy_TechnologyTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_Technology_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_Technology where 1 = 1";
string sql = sql1 + sWhere + " order by 工艺参数分类代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_Technology");
//添加列名
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_TechnologyParameterClass")]
[HttpGet]
public object AuditGy_TechnologyParameterClass(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_Technology_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameterClass where HItemID=" + HInterID, "Gy_TechnologyParameterClass");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_TechnologyParameterClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_TechnologyParameterClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_TechnologyParameterClass")]
[HttpGet]
public object StopGy_TechnologyParameterClass(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_Technology_Stop", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameterClass where HItemID=" + HInterID, "Gy_TechnologyParameterClass");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_TechnologyParameterClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_TechnologyParameterClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_CusTypeList")]
[HttpGet]
public object Gy_CusTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_CusType_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_CusType where 1 = 1";
string sql = sql1 + sWhere;
ds = oCN.RunProcReturn(sql, "h_v_Gy_CusType");
//添加列名
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_CusType")]
[HttpGet]
public object AuditGy_CusType(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_CusType_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_CusType where HItemID=" + HInterID, "Gy_CusType");
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_CusType 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_CusType 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_CusType")]
[HttpGet]
public object StopGy_CusType(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_CusType_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_CusType where HItemID=" + HInterID, "Gy_CusType");
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_CusType 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_CusType 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_StockCheckItemList")]
[HttpGet]
public object Gy_StockCheckItemList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_StockCheckItem_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_StockCheckItem where 1 = 1";
string sql = sql1 + sWhere + " order by 盘点方案代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_StockCheckItem");
//添加列名
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_StockCheckItem")]
[HttpGet]
public object AuditGy_StockCheckItem(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockCheckItem_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockCheckItem where HItemID=" + HInterID, "Gy_StockCheckItem");
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_StockCheckItem 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_StockCheckItem 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_StockCheckItem")]
[HttpGet]
public object StopGy_StockCheckItem(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_StockCheckItem_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_StockCheckItem where HItemID=" + HInterID, "Gy_StockCheckItem");
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_StockCheckItem 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_StockCheckItem 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_ProjectMoneyList")]
[HttpGet]
public object Gy_ProjectMoneyList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoney_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_ProjectMoney where 1 = 1";
string sql = sql1 + sWhere + " order by 项目费用代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_ProjectMoney");
//添加列名
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_ProjectMoney")]
[HttpGet]
public object AuditGy_ProjectMoney(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectMoney_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HItemID=" + HInterID, "Gy_ProjectMoney");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoney_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoney set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoney_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoney_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoney set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoney_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_ProjectMoney")]
[HttpGet]
public object StopGy_ProjectMoney(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectMoney_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoney_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoney set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoney_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoney_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoney set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoney_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_ProjectMoneyClassList")]
[HttpGet]
public object Gy_ProjectMoneyClassList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoneyClass_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_ProjectMoneyClass where 1 = 1";
string sql = sql1 + sWhere + " order by 项目费用分类代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_ProjectMoneyClass");
//添加列名
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_ProjectMoneyClass")]
[HttpGet]
public object AuditGy_ProjectMoneyClass(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectMoneyClass_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ProjectMoneyClass where HItemID=" + HInterID, "Gy_ProjectMoneyClass");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoneyClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoneyClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_ProjectMoneyClass")]
[HttpGet]
public object StopGy_ProjectMoneyClass(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectMoneyClass_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ProjectMoneyClass where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoneyClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_ProjectMoneyClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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;
}
}
//项目费用分类 树形图(根据代码展开树状图)
public class TreeModel
{
public string id { get; set; }
public string title { get; set; }
public List children = new List();
}
[Route("Gy_BadReason/Gy_ProjectMoneyClassTreeList")]
[HttpGet]
public object Gy_ProjectMoneyClassTreeList()
{
try
{
string sql1 = string.Format("select HItemID,HNumber,HName,HParentID from Gy_ProjectMoneyClass where HEndFlag =0 order by HNumber");
ds = oCN.RunProcReturn(sql1, "Gy_ProjectMoneyClass");
List treeModels = new List();
TreeModel first = new TreeModel();
first.id = "0";
first.title = "项目费用分类";
treeModels.Add(first);
foreach (DataRow row in ds.Tables[0].Rows)
{
var HParentID = (int)row["HParentID"];
if (HParentID == 0)
{
TreeModel tree = new TreeModel();
tree.id = row["hitemid"].ToString();
tree.title = row["hname"].ToString();
treeModels[0].children.Add(tree);
}
}
getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 递归构建树形结构
///
public void getTreeByLevel(DataTable dt, List tree, int num)
{
for (int m = 0; m < tree.Count; m++)
{
tree[m].children = new List();
for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集
{
var HParentID = dt.Rows[i]["HParentID"].ToString();
if (HParentID == tree[m].id)
{
TreeModel tbjson = new TreeModel();
tbjson.id = dt.Rows[i]["hitemid"].ToString();
tbjson.title = dt.Rows[i]["hname"].ToString();
tree[m].children.Add(tbjson);
}
}
for (int i = 0; i < tree[m].children.Count; i++)
{
getTreeByLevel(dt, tree[m].children, num + 1);//再次用子集去循环,拿出子集的子集
}
}
}
#endregion
#region 异常反馈类型 查询,审核,反审核,禁用,反禁用
///
/// 异常反馈类型 查询
///
///
///
///
[Route("Gy_BadReason/Gy_ErrMsgBackTypeList")]
[HttpGet]
public object Gy_ErrMsgBackTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_ErrMsgBackType_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_ErrMsgBackType where 1 = 1";
string sql = sql1 + sWhere + " order by 异常反馈类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_ErrMsgBackType");
//添加列名
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_ErrMsgBackType")]
[HttpGet]
public object AuditGy_ErrMsgBackType(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ErrMsgBackType_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ErrMsgBackType where HItemID=" + HInterID, "Gy_ErrMsgBackType");
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) //审核判断
{
//审核前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeCheckCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_ErrMsgBackType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterCheckCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeUnCheckCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_ErrMsgBackType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterUnCheckCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
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_ErrMsgBackType")]
[HttpGet]
public object StopGy_ErrMsgBackType(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ErrMsgBackType_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ErrMsgBackType where HItemID=" + HInterID, "Gy_ErrMsgBackType");
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) //禁用判断
{
//禁用前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeStopCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_ErrMsgBackType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterStopCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeUnStopCtrl");
if (ds == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用前判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
oCN.RunProc("update Gy_ErrMsgBackType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterUnStopCtrl");
if (ds2 == null)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用后判断失败!";
objJsonResult.data = null;
return objJsonResult;
}
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
objJsonResult.data = null;
return objJsonResult;
}
//=========================================================
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_ErrTypeList")]
[HttpGet]
public object Gy_ErrTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_ErrType_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_ErrTypeList where 1 = 1";
string sql = sql1 + sWhere + " order by 异常类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_ErrTypeList");
//添加列名
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_ErrType")]
[HttpGet]
public object AuditGy_ErrType(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ErrType_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ErrType where HItemID=" + HInterID, "Gy_ErrType");
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_ErrType 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_ErrType 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_ErrType")]
[HttpGet]
public object StopGy_ErrType(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ErrType_Stop", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ErrType where HItemID=" + HInterID, "Gy_ErrType");
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_ErrType 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_ErrType 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 不良现象 查询,审核,反审核,禁用,反禁用
///
/// 不良现象 查询
/// Gy_BadPhenomena
///
///
///
[Route("Gy_BadReason/Gy_BadPhenomenaList")]
[HttpGet]
public object Gy_BadPhenomenaList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadPhenomena_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_BadPhenomena where 1 = 1";
string sql = sql1 + sWhere + " order by 不良现象代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_BadPhenomena");
//添加列名
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_BadPhenomena")]
[HttpGet]
public object AuditGy_BadPhenomena(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadPhenomena_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadPhenomena where HItemID=" + HInterID, "Gy_BadPhenomena");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_BadPhenomena_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadPhenomena set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_BadPhenomena_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_BadPhenomena_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadPhenomena set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_BadPhenomena_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_BadPhenomena")]
[HttpGet]
public object StopGy_BadPhenomena(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadPhenomena_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadPhenomena where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadPhenomena_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadPhenomena set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadPhenomena_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_BadPhenomena_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_BadPhenomena set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_BadPhenomena_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_ProjectClassList")]
[HttpGet]
public object Gy_ProjectClassList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_ProjectClass_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_ProjectClass where 1 = 1";
string sql = sql1 + sWhere + " order by 项目类别代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_ProjectClass");
//添加列名
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_ProjectClass")]
[HttpGet]
public object AuditGy_ProjectClass(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectClass_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ProjectClass where HItemID=" + HInterID, "Gy_ProjectClass");
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_ProjectClass 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_ProjectClass 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_ProjectClass")]
[HttpGet]
public object StopGy_ProjectClass(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectClass_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_ProjectClass where HItemID=" + HInterID, "Gy_SupType");
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_ProjectClass 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_ProjectClass 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_TaskClassList")]
[HttpGet]
public object Gy_TaskClassList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_TaskClass_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_TaskClass where 1 = 1";
string sql = sql1 + sWhere + " order by 任务类别代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_TaskClass");
//添加列名
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_TaskClass")]
[HttpGet]
public object AuditGy_TaskClass(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_TaskClass_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_TaskClass where HItemID=" + HInterID, "Gy_TaskClass");
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_TaskClass 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_TaskClass 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_TaskClass")]
[HttpGet]
public object StopGy_TaskClass(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_TaskClass_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_TaskClass where HItemID=" + HInterID, "Gy_SupType");
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_TaskClass 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_TaskClass 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_PreventErrMouldList")]
[HttpGet]
public object Gy_PreventErrMouldList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_PreventErrMould where 1 = 1";
string sql = sql1 + sWhere + " order by 防错装置代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_PreventErrMould");
//添加列名
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_PreventErrMould")]
[HttpGet]
public object AuditGy_PreventErrMould(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PreventErrMould_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + HInterID, "Gy_PreventErrMould");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_PreventErrMould_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_PreventErrMould_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_PreventErrMould_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_PreventErrMould_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_PreventErrMould")]
[HttpGet]
public object StopGy_PreventErrMould(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PreventErrMould_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_PreventErrMould_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PreventErrMould set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_PreventErrMould_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_PreventErrMould_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PreventErrMould set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_PreventErrMould_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_MaintainLevList")]
[HttpGet]
public object Gy_MaintainLevList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_MaintainLev_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_MaintainLev where 1 = 1";
string sql = sql1 + sWhere + " order by 保养级别代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_MaintainLev");
//添加列名
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_MaintainLev")]
[HttpGet]
public object AuditGy_MaintainLev(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_MaintainLev_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_MaintainLev where HItemID=" + HInterID, "Gy_MaintainLev");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_MaintainLev_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_MaintainLev set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_MaintainLev_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_MaintainLev_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_MaintainLev set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_MaintainLev_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_MaintainLev")]
[HttpGet]
public object StopGy_MaintainLev(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_MaintainLev_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_MaintainLev where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_MaintainLev_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_MaintainLev set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_MaintainLev_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_MaintainLev_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_MaintainLev set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_MaintainLev_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_CheckNoteItemList")]
[HttpGet]
public object Gy_CheckNoteItemList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_CheckNoteItem_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_CheckNoteItem where 1 = 1";
string sql = sql1 + sWhere + " order by 启动检查项目代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_CheckNoteItem");
//添加列名
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_CheckNoteItem")]
[HttpGet]
public object AuditGy_CheckNoteItem(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_CheckNoteItem_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HItemID=" + HInterID, "Gy_CheckNoteItem");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_CheckNoteItem set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_CheckNoteItem_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_CheckNoteItem set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_CheckNoteItem_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_CheckNoteItem")]
[HttpGet]
public object StopGy_CheckNoteItem(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_CheckNoteItem_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_CheckNoteItem set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_CheckNoteItem_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_CheckNoteItem set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_CheckNoteItem_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_RestDayList")]
[HttpGet]
public object Gy_RestDayList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_RestDay_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_RestDay where 1 = 1";
string sql = sql1 + sWhere + " order by 休息日代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_RestDay");
//添加列名
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_RestDay")]
[HttpGet]
public object AuditGy_RestDay(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_RestDay_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_RestDay where HItemID=" + HInterID, "Gy_RestDay");
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_RestDay 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_RestDay 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_RestDay")]
[HttpGet]
public object StopGy_RestDay(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_RestDay_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_RestDay where HItemID=" + HInterID, "Gy_SupType");
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_RestDay 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_RestDay 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_EnvironmentTestItemList")]
[HttpGet]
public object Gy_EnvironmentTestItemList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestItem_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_EnvironmentTestItem where 1 = 1";
string sql = sql1 + sWhere + " order by 检测代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_EnvironmentTestItem");
//添加列名
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_EnvironmentTestItem")]
[HttpGet]
public object AuditGy_EnvironmentTestItem(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_EnvironmentTestItem_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_EnvironmentTestItem where HItemID=" + HInterID, "Gy_EnvironmentTestItem");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_EnvironmentTestItem set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_EnvironmentTestItem set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_EnvironmentTestItem")]
[HttpGet]
public object StopGy_EnvironmentTestItem(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_EnvironmentTestItem_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_EnvironmentTestItem where HItemID=" + HInterID, "Gy_EnvironmentTestItem");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_EnvironmentTestItem set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_EnvironmentTestItem set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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;
}
}
#region 校验项目列表 文件上传
[Route("Gy_EnvironmentTestItem/Gy_EnvironmentTestItem_Excel")]
[HttpPost]
public json Gy_EnvironmentTestItem_Excel()
{
json res = new json();
try
{
//获取文件名称
var file = HttpContext.Current.Request.Files[0];
//获取文件物理路径
string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
//保存文件
file.SaveAs(ExcelPath);
NpoiHelper np = new NpoiHelper();
DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
//删除文件
File.Delete(ExcelPath);
//创建临时表
DataTable provisional = new DataTable("dt2");
//添加列名
for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
{
provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
}
//添加数据
for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
{
DataRow row = provisional.NewRow();
for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
{
row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
}
provisional.Rows.Add(row);
}
//判断列
string error = JudgmentGy_EnvironmentTestItemColumns(provisional);
if (error.Length > 0)
{
res.code = "0";
res.count = 0;
res.Message = $"Excel模板存在错误,{error}\r\n";
res.data = null;
return res;
}
for (int i = 0; i <= provisional.Rows.Count - 1; i++)
{
string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检测代码"].ToString());
string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检测名称"].ToString());
string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["助记码"]);
string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString());
//获取真实行数
int line = i + 1;
}
res.code = "1";
res.count = 1;
res.Message = error;
res.data = provisional;
return res;
}
catch (Exception e)
{
res.code = "0";
res.count = 0;
res.Message = "Exception!" + e.ToString();
res.data = null;
return res;
}
}
///
/// 判断环境检测单列
///
///
///
private static string JudgmentGy_EnvironmentTestItemColumns(DataTable provisional)
{
var error = "";
//查询没有的列
if (!provisional.Columns.Contains("检测代码"))
error += "没有找到【检测代码】的标题,";
if (!provisional.Columns.Contains("检测名称"))
error += "没有找到【检测名称】的标题,";
return error;
}
#endregion
#region 环境检测单列表 导入(保存)
[Route("Gy_EnvironmentTestItem/Gy_EnvironmentTestItem_btnSave")]
[HttpPost]
public object Gy_EnvironmentTestItem_btnSave([FromBody] JObject sMainSub)
{
var _value = sMainSub["sMainSub"].ToString();
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { "&和" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();
string user = sArray[1].ToString();
string organ = sArray[2].ToString();
try
{
if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestItem_Edit", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无保存权限!";
objJsonResult.data = null;
return objJsonResult;
}
List Excel = Newtonsoft.Json.JsonConvert.DeserializeObject>(msg2);
List> list = new List>();
foreach (JObject item in Excel)
{
Dictionary dic = new Dictionary();
foreach (var itm in item.Properties())
{
dic.Add(itm.Name, itm.Value.ToString());
}
list.Add(dic);
}
oCN.BeginTran();
int i = 1;
foreach (Dictionary item in list)
{
string HNumber = item["检测代码"].ToString();
string HName = item["检测名称"].ToString();
string HHelpCode = item["助记码"];
string HRemark = item["备注"].ToString();
string sShortNumber;
sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//短代码
if (sShortNumber.Trim() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "保存失败!短代码为空!";
objJsonResult.data = 1;
return objJsonResult;
}
int HEndFlag = 1;//末级标志
int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //等级
if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
objJsonResult.data = 1;
return objJsonResult;
}
ds = oCN.RunProcReturn("select * from Gy_EnvironmentTestItem where HNumber='" + HNumber + "' and HName='" + HName + "'", "Gy_EnvironmentTestItem");
if (ds.Tables[0].Rows.Count == 0)
{
string sql = "insert into Gy_EnvironmentTestItem (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HMakeTime,HMakeEmp)" +
$"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '未使用', '{organ}', '{organ}', '{System.DateTime.Now.ToString("G")}', '{user}')";
oCN.RunProc(sql);
}
else
{
oCN.RunProc("update Gy_EnvironmentTestItem set HName='" + HName + "', HHelpCode= '" + HHelpCode + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "' where HNumber= '" + HNumber + "'");
}
i++;
}
oCN.Commit();
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "导入成功!";
objJsonResult.data = null;
return objJsonResult;
}
catch (Exception e)
{
LogService.Write(e);
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#endregion
#region 管径 查询,审核,反审核,禁用,反禁用
///
/// 管径 查询
///
///
///
///
[Route("Gy_BadReason/Gy_PiPeList")]
[HttpGet]
public object Gy_PiPeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_PiPe_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_PiPe where 1 = 1";
string sql = sql1 + sWhere + " order by 管径代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_PiPe");
//添加列名
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_PiPe")]
[HttpGet]
public object AuditGy_PiPe(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPe_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PiPe where HItemID=" + HInterID, "Gy_PiPe");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_PiPe_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPe set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_PiPe_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_PiPe_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPe set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_PiPe_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_PiPe")]
[HttpGet]
public object StopGy_PiPe(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPe_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PiPe where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_PiPe_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPe set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_PiPe_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_PiPe_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPe set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_PiPe_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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;
}
}
///
/// 管径树状图
///
///
[Route("Gy_BadReason/Gy_PiPeTreeList")]
[HttpGet]
public object Gy_PiPeTreeList()
{
try
{
string sql1 = string.Format("select HItemID,HNumber,HName,HParentID from Gy_PiPe where HEndFlag =0 order by HNumber");
ds = oCN.RunProcReturn(sql1, "Gy_PiPe");
List treeModels = new List();
TreeModel first = new TreeModel();
first.id = "0";
first.title = "管径";
treeModels.Add(first);
foreach (DataRow row in ds.Tables[0].Rows)
{
var HParentID = (int)row["HParentID"];
if (HParentID == 0)
{
TreeModel tree = new TreeModel();
tree.id = row["hitemid"].ToString();
tree.title = row["hname"].ToString();
treeModels[0].children.Add(tree);
}
}
getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
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_PiPeMaterialList")]
[HttpGet]
public object Gy_PiPeMaterialList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_PiPeMaterial_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_PiPeMaterial where 1 = 1";
string sql = sql1 + sWhere + " order by 管径材质代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_PiPeMaterial");
//添加列名
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_PiPeMaterial")]
[HttpGet]
public object AuditGy_PiPeMaterial(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPeMaterial_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PiPeMaterial where HItemID=" + HInterID, "Gy_PiPeMaterial");
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) //审核判断
{
//审核前控制=========================================
string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPeMaterial set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
//审核后控制=========================================
string sql2 = "exec h_p_Gy_PiPeMaterial_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
//反审核前控制=========================================
string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPeMaterial set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
//反审核后控制=========================================
string sql2 = "exec h_p_Gy_PiPeMaterial_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterCheckCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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_PiPeMaterial")]
[HttpGet]
public object StopGy_PiPeMaterial(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPeMaterial_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_PiPeMaterial where HItemID=" + HInterID, "Gy_SupType");
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) //禁用判断
{
//禁用前控制=========================================
string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPeMaterial set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
//禁用后控制=========================================
string sql2 = "exec h_p_Gy_PiPeMaterial_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
//反禁用前控制=========================================
string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
oCN.RunProc("update Gy_PiPeMaterial set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
//反禁用后控制=========================================
string sql2 = "exec h_p_Gy_PiPeMaterial_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterUnStopCtrl");
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
objJsonResult.data = null;
oCN.RollBack();
return objJsonResult;
}
//==================================================================================
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;
}
}
///
/// 管径材质 树形
///
///
[Route("Gy_BadReason/Gy_PiPeMaterialTreeList")]
[HttpGet]
public object Gy_PiPeMaterialTreeList()
{
try
{
string sql1 = string.Format("select HItemID,HNumber,HName,HParentID from Gy_PiPeMaterial where HEndFlag =0 order by HNumber");
ds = oCN.RunProcReturn(sql1, "Gy_PiPeMaterial");
List treeModels = new List();
TreeModel first = new TreeModel();
first.id = "0";
first.title = "管径材质";
treeModels.Add(first);
foreach (DataRow row in ds.Tables[0].Rows)
{
var HParentID = (int)row["HParentID"];
if (HParentID == 0)
{
TreeModel tree = new TreeModel();
tree.id = row["hitemid"].ToString();
tree.title = row["hname"].ToString();
treeModels[0].children.Add(tree);
}
}
getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
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/Sb_EqiupMaterWorkTimeList")]
[HttpGet]
public object Sb_EqiupMaterWorkTimeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
string sql1 = "select * from h_v_Sb_EqiupMaterWorkTimes where 1 = 1";
string sql = sql1 + sWhere + " order by 设备代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Sb_EqiupMaterWorkTimes");
//添加列名
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
}
}