WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -7,6 +7,7 @@
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.Controllers.SCGL.日计划管理;
@@ -21,11 +22,9 @@
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region 不良原因 查询,审核,反审核,禁用,反禁用
        /// <summary>
        /// 返回不良原因列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Gy_BadReason/list")]
        [HttpGet]
@@ -35,7 +34,7 @@
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_BadReason", 1, false, user))
                if (!DBUtility.ClsPub.Security_Log("Gy_BadReason_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -157,7 +156,58 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadReason_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadReason set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadReason_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -166,7 +216,61 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadReason_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadReason set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadReason_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -252,7 +356,58 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadReason_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadReason set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadReason_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -261,7 +416,58 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadReason_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadReason set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadReason_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadReason_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -284,52 +490,10 @@
        }
        #endregion
        #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
@@ -448,7 +612,56 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadResult_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadResult set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadResult_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -457,7 +670,58 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadResult_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadResult set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadResult_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -543,7 +807,56 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadResult_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadResult set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadResult_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -552,7 +865,56 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadResult_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadResult_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadResult set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadResult_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadResult_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1681,9 +2043,61 @@
        #endregion
        #region 不良类型审核、反审核
        #region 不良类型 查询,审核、反审核,禁用,反禁用
        /// <summary>
        ///
        /// 不良类型  查询
        /// </summary>
        /// <param name="sWhere"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        [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;
            }
        }
        /// <summary>
        /// 不良类型 审核、反审核
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -1744,7 +2158,56 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadType_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadType_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1753,7 +2216,58 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadType_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadType_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1774,11 +2288,9 @@
                return objJsonResult;
            }
        }
        #endregion
        #region 不良类型禁用、反禁用
        /// <summary>
        ///
        /// 不良类型 禁用、反禁用
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
@@ -1839,7 +2351,57 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadType_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadType_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1848,7 +2410,57 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadType_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadType_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadType_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2646,7 +3258,57 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PostSkill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PostSkill set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PostSkill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2655,7 +3317,58 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PostSkill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PostSkill set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PostSkill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2741,7 +3454,57 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PostSkill_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PostSkill set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PostSkill_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2750,7 +3513,57 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PostSkill_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PostSkill_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PostSkill set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PostSkill_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PostSkill_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2888,7 +3701,57 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_Post_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_Post set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_Post_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2897,7 +3760,58 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_Post_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_Post set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_Post_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2983,7 +3897,56 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_Post_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_Post set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_Post_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -2992,7 +3955,56 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_Post_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Post_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_Post set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_Post_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_Post_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -4711,7 +5723,7 @@
        #region  工艺参数分类  查询,审核,反审核,禁用,反禁用
        /// <summary> 
        /// 供应商分类  查询
        /// 工艺参数分类  查询
        /// </summary>
        /// <param name="sWhere"></param>
        /// <param name="user"></param>
@@ -4763,20 +5775,216 @@
        }
        /// <summary>
        /// 供应商分类 禁用、反禁用
        /// 工艺参数分类审核、反审核
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/AuditGy_TechnologyParameterClass")]
        [HttpGet]
        public object AuditGy_TechnologyParameterClass(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Technology_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_TechnologyParameterClass where HItemID=" + HInterID, "Gy_TechnologyParameterClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_TechnologyParameterClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_TechnologyParameterClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 工艺参数分类禁用、反禁用
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/StopGy_TechnologyType")]
        [Route("Gy_BadReason/StopGy_TechnologyParameterClass")]
        [HttpGet]
        public object StopGy_TechnologyType(int HInterID, int IsStop, string CurUserName)
        public object StopGy_TechnologyParameterClass(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyType_Close", 1, false, CurUserName))
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Technology_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -4790,7 +5998,7 @@
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopflag"].Equals(true))
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -4801,7 +6009,7 @@
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopflag"].Equals(false))
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -4824,7 +6032,58 @@
                if (IsStop == 0)  //禁用判断
                {
                    oCN.RunProc("update Gy_TechnologyParameterClass set HStopflag=1 where HItemID=" + HInterID);
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_TechnologyParameterClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -4833,7 +6092,58 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    oCN.RunProc("update Gy_TechnologyParameterClass set HStopflag=0 where HItemID=" + HInterID);
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_TechnologyParameterClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_TechnologyParameterClass_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_TechnologyParameterClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_TechnologyParameterClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_TechnologyParameterClass_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5001,8 +6311,7 @@
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
@@ -5097,6 +6406,8 @@
                return objJsonResult;
            }
        }
        #endregion
        #region  盘点方案  查询,审核,反审核,禁用,反禁用
        /// <summary> 
@@ -5455,7 +6766,55 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoney_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoney set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoney_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5464,7 +6823,56 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoney_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoney set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoney_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5550,7 +6958,56 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoney_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoney set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoney_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5559,7 +7016,56 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoney_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoney_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoney set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoney_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoney_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5580,6 +7086,525 @@
                return objJsonResult;
            }
        }
        #endregion
        #region  项目费用分类  查询,审核,反审核,禁用,反禁用
        /// <summary>
        /// 项目费用分类  查询
        /// </summary>
        /// <param name="sWhere"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        [Route("Gy_BadReason/Gy_ProjectMoneyClassList")]
        [HttpGet]
        public object Gy_ProjectMoneyClassList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_ProjectMoneyClass_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from  h_v_Gy_ProjectMoneyClass where 1 = 1";
                string sql = sql1 + sWhere + " order by 项目费用分类代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_ProjectMoneyClass");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 项目费用分类 审核、反审核
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/AuditGy_ProjectMoneyClass")]
        [HttpGet]
        public object AuditGy_ProjectMoneyClass(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectMoneyClass_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_ProjectMoneyClass where HItemID=" + HInterID, "Gy_ProjectMoneyClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoneyClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoneyClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 项目费用分类 禁用、反禁用
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/StopGy_ProjectMoneyClass")]
        [HttpGet]
        public object StopGy_ProjectMoneyClass(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_ProjectMoneyClass_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_ProjectMoneyClass where HItemID=" + HInterID, "Gy_SupType");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoneyClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_ProjectMoneyClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ProjectMoneyClass_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_ProjectMoneyClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_ProjectMoneyClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_ProjectMoneyClass_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //项目费用分类 树形图(根据代码展开树状图)
        public class TreeModel
        {
            public string id { get; set; }
            public string title { get; set; }
            public List<TreeModel> children = new List<TreeModel>();
        }
        [Route("Gy_BadReason/Gy_ProjectMoneyClassTreeList")]
        [HttpGet]
        public object Gy_ProjectMoneyClassTreeList()
        {
            try
            {
                string sql1 = string.Format("select HItemID,HNumber,HName,HParentID from Gy_ProjectMoneyClass where HEndFlag =0 order by HNumber");
                ds = oCN.RunProcReturn(sql1, "Gy_ProjectMoneyClass");
                List<TreeModel> treeModels = new List<TreeModel>();
                TreeModel first = new TreeModel();
                first.id = "0";
                first.title = "项目费用分类";
                treeModels.Add(first);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    var HParentID = (int)row["HParentID"];
                    if (HParentID == 0)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 递归构建树形结构
        /// </summary>
        public void getTreeByLevel(DataTable dt, List<TreeModel> tree, int num)
        {
            for (int m = 0; m < tree.Count; m++)
            {
                tree[m].children = new List<TreeModel>();
                for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集
                {
                    var HParentID = dt.Rows[i]["HParentID"].ToString();
                    if (HParentID == tree[m].id)
                    {
                        TreeModel tbjson = new TreeModel();
                        tbjson.id = dt.Rows[i]["hitemid"].ToString();
                        tbjson.title = dt.Rows[i]["hname"].ToString();
                        tree[m].children.Add(tbjson);
                    }
                }
                for (int i = 0; i < tree[m].children.Count; i++)
                {
                    getTreeByLevel(dt, tree[m].children, num + 1);//再次用子集去循环,拿出子集的子集
                }
            }
        }
        #endregion
        #region  异常反馈类型  查询,审核,反审核,禁用,反禁用
@@ -6001,7 +8026,7 @@
        }
        #endregion
        #region 异常类型  查询
        #region 异常类型  查询,审核,反审核,禁用,反禁用
        [Route("Gy_BadReason/Gy_ErrTypeList")]
        [HttpGet]
        public object Gy_ErrTypeList(string sWhere, string user)
@@ -6048,11 +8073,8 @@
            }
        }
        #endregion
        #region 异常类型审核、反审核
        /// <summary>
        ///
        /// 异常类型审核、反审核
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -6143,11 +8165,9 @@
                return objJsonResult;
            }
        }
        #endregion
        #region 异常类型禁用、反禁用
        /// <summary>
        ///
        /// 异常类型禁用、反禁用
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
@@ -6355,7 +8375,58 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadPhenomena_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadPhenomena set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadPhenomena_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -6364,7 +8435,60 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_BadPhenomena_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadPhenomena set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_BadPhenomena_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -6450,7 +8574,59 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadPhenomena_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadPhenomena set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadPhenomena_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -6459,8 +8635,60 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_BadPhenomena_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadPhenomena_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_BadPhenomena set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_BadPhenomena_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_BadPhenomena_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
@@ -7081,7 +9309,57 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PreventErrMould_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PreventErrMould_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7090,7 +9368,60 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PreventErrMould_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PreventErrMould_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7176,7 +9507,58 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PreventErrMould_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PreventErrMould set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PreventErrMould_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7185,7 +9567,58 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PreventErrMould_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PreventErrMould_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PreventErrMould set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PreventErrMould_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PreventErrMould_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7323,7 +9756,59 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_MaintainLev_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaintainLev set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_MaintainLev_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7332,7 +9817,61 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_MaintainLev_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaintainLev set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_MaintainLev_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7418,7 +9957,60 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_MaintainLev_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaintainLev set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_MaintainLev_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7427,7 +10019,58 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_MaintainLev_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaintainLev_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaintainLev set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_MaintainLev_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaintainLev_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7565,8 +10208,58 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_CheckNoteItem set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_CheckNoteItem_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
@@ -7574,7 +10267,59 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_CheckNoteItem set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_CheckNoteItem_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7660,7 +10405,58 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_CheckNoteItem set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_CheckNoteItem_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -7669,7 +10465,57 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_CheckNoteItem_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_CheckNoteItem_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_CheckNoteItem set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_CheckNoteItem_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_CheckNoteItem_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -8049,7 +10895,58 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_EnvironmentTestItem set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -8058,7 +10955,57 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_EnvironmentTestItem set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -8144,7 +11091,58 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_EnvironmentTestItem set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -8153,7 +11151,58 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_EnvironmentTestItem set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_EnvironmentTestItem_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_EnvironmentTestItem_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -8376,5 +11425,981 @@
        }
        #endregion
        #endregion
        #region  管径  查询,审核,反审核,禁用,反禁用
        /// <summary>
        /// 管径  查询
        /// </summary>
        /// <param name="sWhere"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        [Route("Gy_BadReason/Gy_PiPeList")]
        [HttpGet]
        public object Gy_PiPeList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_PiPe_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from  h_v_Gy_PiPe where 1 = 1";
                string sql = sql1 + sWhere + " order by 管径代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_PiPe");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 管径 审核、反审核
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/AuditGy_PiPe")]
        [HttpGet]
        public object AuditGy_PiPe(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPe_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_PiPe where HItemID=" + HInterID, "Gy_PiPe");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPe_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPe set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPe_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPe_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPe set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPe_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 管径 禁用、反禁用
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/StopGy_PiPe")]
        [HttpGet]
        public object StopGy_PiPe(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPe_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_PiPe where HItemID=" + HInterID, "Gy_SupType");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPe_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPe set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPe_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPe_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPe_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPe set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPe_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPe_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 管径树状图
        /// </summary>
        /// <returns></returns>
        [Route("Gy_BadReason/Gy_PiPeTreeList")]
        [HttpGet]
        public object Gy_PiPeTreeList()
        {
            try
            {
                string sql1 = string.Format("select HItemID,HNumber,HName,HParentID from Gy_PiPe where HEndFlag =0 order by HNumber");
                ds = oCN.RunProcReturn(sql1, "Gy_PiPe");
                List<TreeModel> treeModels = new List<TreeModel>();
                TreeModel first = new TreeModel();
                first.id = "0";
                first.title = "管径";
                treeModels.Add(first);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    var HParentID = (int)row["HParentID"];
                    if (HParentID == 0)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  管径材质  查询,审核,反审核,禁用,反禁用
        /// <summary>
        /// 管径材质  查询
        /// </summary>
        /// <param name="sWhere"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        [Route("Gy_BadReason/Gy_PiPeMaterialList")]
        [HttpGet]
        public object Gy_PiPeMaterialList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_PiPeMaterial_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from  h_v_Gy_PiPeMaterial where 1 = 1";
                string sql = sql1 + sWhere + " order by 管径材质代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_PiPeMaterial");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 管径材质 审核、反审核
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/AuditGy_PiPeMaterial")]
        [HttpGet]
        public object AuditGy_PiPeMaterial(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPeMaterial_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_PiPeMaterial where HItemID=" + HInterID, "Gy_PiPeMaterial");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPeMaterial set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPeMaterial_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPeMaterial set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPeMaterial_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 管径材质 禁用、反禁用
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/StopGy_PiPeMaterial")]
        [HttpGet]
        public object StopGy_PiPeMaterial(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PiPeMaterial_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_PiPeMaterial where HItemID=" + HInterID, "Gy_SupType");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPeMaterial set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPeMaterial_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_PiPeMaterial_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_PiPeMaterial_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_PiPeMaterial set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_PiPeMaterial_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_PiPeMaterial_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 管径材质  树形
        /// </summary>
        /// <returns></returns>
        [Route("Gy_BadReason/Gy_PiPeMaterialTreeList")]
        [HttpGet]
        public object Gy_PiPeMaterialTreeList()
        {
            try
            {
                string sql1 = string.Format("select HItemID,HNumber,HName,HParentID from Gy_PiPeMaterial where HEndFlag =0 order by HNumber");
                ds = oCN.RunProcReturn(sql1, "Gy_PiPeMaterial");
                List<TreeModel> treeModels = new List<TreeModel>();
                TreeModel first = new TreeModel();
                first.id = "0";
                first.title = "管径材质";
                treeModels.Add(first);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    var HParentID = (int)row["HParentID"];
                    if (HParentID == 0)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}