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.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;
///
/// 返回不良原因列表
///参数:string sql。
///返回值:object。
///
[Route("Gy_BadReason/list")]
[HttpGet]
public object list(string sWhere,string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadReason", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn("select * from h_v_IF_BadReasonList " + sWhere+ " order by 不良原因代码 ", "h_v_IF_BadReasonList");
}
else
{
string sql1 = "select * from h_v_IF_BadReasonList where 1 = 1";
string sql = sql1 + sWhere+ " order by 不良原因代码 ";
ds = oCN.RunProcReturn(sql, "h_v_IF_BadReasonList");
}
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
//if (ds.Tables[0].Rows.Count != 0 || ds != null)
//{
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
//}
//else
//{
//objJsonResult.code = "0";
//objJsonResult.count = 0;
//objJsonResult.Message = "无数据";
//objJsonResult.data = null;
//return objJsonResult;
//}
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#region 不良原因审核、反审核
///
///
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_BadReason")]
[HttpGet]
public object AuditGy_BadReason(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_BadReason set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_BadReason set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良原因禁用、反禁用
///
///
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_BadReason")]
[HttpGet]
public object StopGy_BadReason(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Stop", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_BadReason set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_BadReason set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良类型 查询
[Route("Gy_BadReason/Gy_BadTypeList")]
[HttpGet]
public object Gy_BadTypeList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadType_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_gy_BadTypeList where 1 = 1";
string sql = sql1 + sWhere + " order by 不良类型代码 ";
ds = oCN.RunProcReturn(sql, "h_v_gy_BadTypeList");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良后果 查询,审核,反审核,禁用,反禁用
///
/// 不良后果 查询
///
///
///
///
[Route("Gy_BadReason/Gy_BadResultList")]
[HttpGet]
public object Gy_BadResultList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_BadResult_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_BadResult where 1 = 1";
string sql = sql1 + sWhere + " order by 不良后果代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_BadResult");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 不良后果审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_BadResult")]
[HttpGet]
public object AuditGy_BadResult(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadResult_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadResult where HItemID=" + HInterID, "Gy_BadResult");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_BadResult set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_BadResult set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 不良后果禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_BadResult")]
[HttpGet]
public object StopGy_BadResult(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_BadResult_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_BadResult where HItemID=" + HInterID, "Gy_BadResult");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_BadResult set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_BadResult set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检测值 查询,审核,反审核,禁用,反禁用
///
/// 检测值 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectValueList")]
[HttpGet]
public object Gy_InspectValueList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectValue_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectValue where 1 = 1";
string sql = sql1 + sWhere + " order by 检测值代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectValue");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检测值审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectValue")]
[HttpGet]
public object AuditGy_InspectValue(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectValue_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectValue where HItemID=" + HInterID, "Gy_InspectValue");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectValue set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectValue set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检测值禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectValue")]
[HttpGet]
public object StopGy_InspectValue(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectValue_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectValue where HItemID=" + HInterID, "Gy_InspectValue");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectValue set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectValue set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检验方法 查询,审核,反审核,禁用,反禁用
///
/// 检验方法 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectMethodList")]
[HttpGet]
public object Gy_InspectMethodList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectMethod_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectMethod where 1 = 1";
string sql = sql1 + sWhere + " order by 检验方法代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectMethod");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验方法审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectMethod")]
[HttpGet]
public object AuditGy_InspectMethod(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectMethod set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectMethod set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验方法禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectMethod")]
[HttpGet]
public object StopGy_InspectMethod(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectMethod set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectMethod set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#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 不良类型审核、反审核
///
///
///
/// 单据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) //审核判断
{
oCN.RunProc("update Gy_BadType 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_BadType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 不良类型禁用、反禁用
///
///
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_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) //禁用判断
{
oCN.RunProc("update Gy_BadType 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_BadType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检验仪器 查询,审核,反审核,禁用,反禁用
///
/// 检验仪器 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectInstruMentList")]
[HttpGet]
public object Gy_InspectInstruMentList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectInstruMent_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectInstruMent where 1 = 1";
string sql = sql1 + sWhere + " order by 检验仪器代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectInstruMent");
//添加列名
foreach (DataColumn col in ds.Tables[0].Columns)
{
Type dataType = col.DataType;
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
}
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess!";
objJsonResult.data = ds.Tables[0];
objJsonResult.list = columnNameList;
return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "Exception!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验仪器 审核、反审核
///
/// 单据ID
/// 审核(0),反审核(1)
/// 审核人
///
[Route("Gy_BadReason/AuditGy_InspectInstruMent")]
[HttpGet]
public object AuditGy_InspectInstruMent(int HInterID, int IsAudit, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectInstruMent_Check", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectInstruMent where HItemID=" + HInterID, "Gy_InspectInstruMent");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsAudit == 0) //审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已审核!不能再次审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsAudit == 1) //反审核判断
{
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未审核!不需要反审核!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsAudit == 0) //审核判断
{
oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "审核成功";
objJsonResult.data = null;
}
if (IsAudit == 1) //反审核判断
{
oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反审核成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
///
/// 检验仪器 禁用、反禁用
///
/// 单据ID
/// 禁用(0),反禁用(1)
/// 审核人
///
[Route("Gy_BadReason/StopGy_InspectInstruMent")]
[HttpGet]
public object StopGy_InspectInstruMent(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectInstruMent_Close", 1, false, CurUserName))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败!无权限!";
objJsonResult.data = null;
return objJsonResult;
}
var ds = oCN.RunProcReturn("select * from Gy_InspectInstruMent where HItemID=" + HInterID, "Gy_InspectInstruMent");
if (ds.Tables[0].Rows.Count > 0)
{
if (IsStop == 0) //禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据未禁用!不需要反禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
}
else
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据不存在!";
objJsonResult.data = null;
return objJsonResult;
}
oCN.BeginTran();
if (IsStop == 0) //禁用判断
{
oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "反禁用成功";
objJsonResult.data = null;
}
oCN.Commit();
return objJsonResult;
}
catch (Exception e)
{
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
#region 检验依据 查询,审核,反审核,禁用,反禁用
///
/// 检验依据 查询
///
///
///
///
[Route("Gy_BadReason/Gy_InspectBasisList")]
[HttpGet]
public object Gy_InspectBasisList(string sWhere, string user)
{
try
{
List columnNameList = new List();
//查看权限
if (!DBUtility.ClsPub.Security_Log("Gy_InspectBasis_Query", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "无查看权限!";
objJsonResult.data = null;
return objJsonResult;
}
string sql1 = "select * from h_v_Gy_InspectBasis where 1 = 1";
string sql = sql1 + sWhere + " order by 检验依据代码 ";
ds = oCN.RunProcReturn(sql, "h_v_Gy_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) //审核判断
{
oCN.RunProc("update Gy_PostSkill 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_PostSkill 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_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) //禁用判断
{
oCN.RunProc("update Gy_PostSkill 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_PostSkill 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_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) //审核判断
{
oCN.RunProc("update Gy_Post 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_Post 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_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) //禁用判断
{
oCN.RunProc("update Gy_Post 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_Post 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_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/StopGy_TechnologyType")]
[HttpGet]
public object StopGy_TechnologyType(int HInterID, int IsStop, string CurUserName)
{
try
{
//审核权限
if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyType_Close", 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]["HStopflag"].Equals(true))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "单据已禁用!不能再次禁用!";
objJsonResult.data = null;
return objJsonResult;
}
}
if (IsStop == 1) //反禁用判断
{
if (ds.Tables[0].Rows[0]["HStopflag"].Equals(false))
{
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_TechnologyParameterClass set HStopflag=1 where HItemID=" + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "禁用成功";
objJsonResult.data = null;
}
if (IsStop == 1) //反禁用判断
{
oCN.RunProc("update Gy_TechnologyParameterClass set 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_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 + " order by 客户分类代码 ";
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;
}
}
#endregion
///
/// 客户分类 禁用、反禁用
///
/// 单据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;
}
}
#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) //审核判断
{
oCN.RunProc("update Gy_ProjectMoney 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_ProjectMoney 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_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) //禁用判断
{
oCN.RunProc("update Gy_ProjectMoney 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_ProjectMoney 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_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) //审核判断
{
oCN.RunProc("update Gy_ErrMsgBackType 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_ErrMsgBackType 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_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) //禁用判断
{
oCN.RunProc("update Gy_ErrMsgBackType 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_ErrMsgBackType 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_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;
}
}
#endregion
#region 异常类型审核、反审核
///
///
///
/// 单据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;
}
}
#endregion
#region 异常类型禁用、反禁用
///
///
///
/// 单据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) //审核判断
{
oCN.RunProc("update Gy_BadPhenomena 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_BadPhenomena 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_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) //禁用判断
{
oCN.RunProc("update Gy_BadPhenomena 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_BadPhenomena 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_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) //审核判断
{
oCN.RunProc("update Gy_PreventErrMould 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_PreventErrMould 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_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) //禁用判断
{
oCN.RunProc("update Gy_PreventErrMould 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_PreventErrMould 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_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) //审核判断
{
oCN.RunProc("update Gy_MaintainLev 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_MaintainLev 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_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) //禁用判断
{
oCN.RunProc("update Gy_MaintainLev 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_MaintainLev 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_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) //审核判断
{
oCN.RunProc("update Gy_CheckNoteItem 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_CheckNoteItem 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_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) //禁用判断
{
oCN.RunProc("update Gy_CheckNoteItem 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_CheckNoteItem 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_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
}
}