using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using Pub_Class;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Web.Http;
|
using WebAPI.Models;
|
namespace WebAPI.Controllers
|
{
|
public class Gy_BadReasonController : ApiController
|
{
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
|
|
private json objJsonResult = new json();
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
DataSet ds;
|
|
|
/// <summary>
|
/// 返回不良原因列表
|
///参数:string sql。
|
///返回值:object。
|
/// </summary>
|
[Route("Gy_BadReason/list")]
|
[HttpGet]
|
public object list(string sWhere,string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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 不良原因审核、反审核
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 不良原因禁用、反禁用
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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<object> columnNameList = new List<object>();
|
//查看权限
|
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 不良后果 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 不良后果 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_BadResultList")]
|
[HttpGet]
|
public object Gy_BadResultList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 不良后果审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 不良后果禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 检测值 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 检测值 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_InspectValueList")]
|
[HttpGet]
|
public object Gy_InspectValueList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 检测值审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 检测值禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 检验方法 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 检验方法 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_InspectMethodList")]
|
[HttpGet]
|
public object Gy_InspectMethodList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 检验方法审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 检验方法禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/StopGy_InspectMethod")]
|
[HttpGet]
|
public object StopGy_InspectMethod(int HInterID, int IsStop, string CurUserName)
|
{
|
try
|
{
|
//审核权限
|
if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Close", 1, false, CurUserName))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "禁用失败!无权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod");
|
if (ds.Tables[0].Rows.Count > 0)
|
{
|
if (IsStop == 0) //禁用判断
|
{
|
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已禁用!不能再次禁用!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
if (IsStop == 1) //反禁用判断
|
{
|
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据未禁用!不需要反禁用!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据不存在!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
oCN.BeginTran();
|
|
if (IsStop == 0) //禁用判断
|
{
|
oCN.RunProc("update Gy_InspectMethod set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用成功";
|
objJsonResult.data = null;
|
}
|
if (IsStop == 1) //反禁用判断
|
{
|
oCN.RunProc("update Gy_InspectMethod set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反禁用成功";
|
objJsonResult.data = null;
|
}
|
oCN.Commit();
|
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
oCN.RollBack();
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 质量标准 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 质量标准 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_QualityStdList")]
|
[HttpGet]
|
public object Gy_QualityStdList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 质量标准 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 质量标准禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 不良类型审核、反审核
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 不良类型禁用、反禁用
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 检验仪器 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 检验仪器 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_InspectInstruMentList")]
|
[HttpGet]
|
public object Gy_InspectInstruMentList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 检验仪器 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 检验仪器 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 检验依据 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 检验依据 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_InspectBasisList")]
|
[HttpGet]
|
public object Gy_InspectBasisList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 检验依据 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 检验依据 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 岗位技能 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 岗位技能 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_PostSkillList")]
|
[HttpGet]
|
public object Gy_PostSkillList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 岗位技能 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 岗位技能 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 岗位 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 岗位 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_PostList")]
|
[HttpGet]
|
public object Gy_PostList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 岗位 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 岗位 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 调拨类型 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 调拨类型 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_StockMoveStyleList")]
|
[HttpGet]
|
public object Gy_StockMoveStyleList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 调拨类型 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 调拨类型 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 入库类型 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 入库类型 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_StockInStyleList")]
|
[HttpGet]
|
public object Gy_StockInStyleList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 入库类型 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 入库类型 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 出库类型 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 出库类型 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_StockOutStyleList")]
|
[HttpGet]
|
public object Gy_StockOutStyleList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 出库类型 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 出库类型 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 地区 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 地区 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_AreaSetList")]
|
[HttpGet]
|
public object Gy_AreaSetList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 地区 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 地区 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 销售方式 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 销售方式 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_SellStyleList")]
|
[HttpGet]
|
public object Gy_SellStyleList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 销售方式 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 销售方式 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 采购方式 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 采购方式 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_PoStockStyleList")]
|
[HttpGet]
|
public object Gy_PoStockStyleList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 采购方式 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 采购方式 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 供应商分类 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 供应商分类 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_SupTypeList")]
|
[HttpGet]
|
public object Gy_SupTypeList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 供应商分类 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 供应商分类 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 客户分类 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 客户分类 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_CusTypeList")]
|
[HttpGet]
|
public object Gy_CusTypeList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 客户分类 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 客户分类 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/StopGy_CusType")]
|
[HttpGet]
|
public object StopGy_CusType(int HInterID, int IsStop, string CurUserName)
|
{
|
try
|
{
|
//审核权限
|
if (!DBUtility.ClsPub.Security_Log_second("Gy_CusType_Close", 1, false, CurUserName))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "禁用失败!无权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
var ds = oCN.RunProcReturn("select * from Gy_CusType where HItemID=" + HInterID, "Gy_CusType");
|
if (ds.Tables[0].Rows.Count > 0)
|
{
|
if (IsStop == 0) //禁用判断
|
{
|
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据已禁用!不能再次禁用!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
if (IsStop == 1) //反禁用判断
|
{
|
if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据未禁用!不需要反禁用!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
}
|
else
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据不存在!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
oCN.BeginTran();
|
|
if (IsStop == 0) //禁用判断
|
{
|
oCN.RunProc("update Gy_CusType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用成功";
|
objJsonResult.data = null;
|
}
|
if (IsStop == 1) //反禁用判断
|
{
|
oCN.RunProc("update Gy_CusType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反禁用成功";
|
objJsonResult.data = null;
|
}
|
oCN.Commit();
|
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
oCN.RollBack();
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 盘点方案 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 盘点方案 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_StockCheckItemList")]
|
[HttpGet]
|
public object Gy_StockCheckItemList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 盘点方案 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 盘点方案 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 项目费用 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 供应商分类 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_ProjectMoneyList")]
|
[HttpGet]
|
public object Gy_ProjectMoneyList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 项目费用 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 项目费用 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 异常反馈类型 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 异常反馈类型 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_ErrMsgBackTypeList")]
|
[HttpGet]
|
public object Gy_ErrMsgBackTypeList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 异常反馈类型 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 异常反馈类型 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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<object> columnNameList = new List<object>();
|
//查看权限
|
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 异常类型审核、反审核
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 异常类型禁用、反禁用
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 不良现象 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 不良现象 查询
|
/// </summary> Gy_BadPhenomena
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_BadPhenomenaList")]
|
[HttpGet]
|
public object Gy_BadPhenomenaList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 不良现象 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 不良现象 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 项目类别 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 项目类别 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_ProjectClassList")]
|
[HttpGet]
|
public object Gy_ProjectClassList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 项目类别 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 项目类别 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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 任务类别 查询,审核,反审核,禁用,反禁用
|
/// <summary>
|
/// 任务类别 查询
|
/// </summary>
|
/// <param name="sWhere"></param>
|
/// <param name="user"></param>
|
/// <returns></returns>
|
[Route("Gy_BadReason/Gy_TaskClassList")]
|
[HttpGet]
|
public object Gy_TaskClassList(string sWhere, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//查看权限
|
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;
|
}
|
}
|
|
/// <summary>
|
/// 任务类别 审核、反审核
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsAudit">审核(0),反审核(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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;
|
}
|
}
|
|
|
|
/// <summary>
|
/// 任务类别 禁用、反禁用
|
/// </summary>
|
/// <param name="HInterID">单据ID</param>
|
/// <param name="IsStop">禁用(0),反禁用(1)</param>
|
/// <param name="CurUserName">审核人</param>
|
/// <returns></returns>
|
[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
|
|
}
|
}
|