1
wtt
2025-03-14 f0b9e513532dd063dc2a48102f710c6add4c802e
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_MaintainBillController.cs
@@ -81,6 +81,87 @@
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» æ ‘形图(根据代码展开树状图)
        public class TreeModel
        {
            public string id { get; set; }
            public string title { get; set; }
            public List<TreeModel> children = new List<TreeModel>();
        }
        [Route("Gy_Maintain/Gy_MaintainTreeList")]
        [HttpGet]
        public object Gy_RepairClassTreeList()
        {
            try
            {
                string sql1 = string.Format("select hitemid,hnumber,hname from Gy_MaintainClass order by hnumber");
                ds = oCN.RunProcReturn(sql1, "Gy_RepairClass");
                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 strLen = row["hnumber"].ToString().Split('.');
                    if (strLen.Length == 1)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                digui(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 digui(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 strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
                    if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(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);
                    }
                }
                var strLens = tree[m].id.Split('.');
                for (int i = 0; i < tree[m].children.Count; i++)
                {
                    digui(dt, tree[m].children, strLens.Length + 2);//再次用子集去循环,拿出子集的子集
                }
            }
        }
        #endregion
        #region ä¿å…»é¡¹ç›®åˆ é™¤
        [Route("Gy_Maintain/DeleteMaintain")]
        [HttpGet]
@@ -100,7 +181,53 @@
                ds = oCN.RunProcReturn("Select * from Gy_Maintain Where HItemID='" + HItemID + "'", "Gy_Maintain", ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    ds = oCN.RunProcReturn("Delete from Gy_Maintain Where HItemID='" + HItemID + "'", "Gy_Maintain", ref DBUtility.ClsPub.sExeReturnInfo);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
@@ -134,7 +261,7 @@
        {
            try
            {
                ds = oCN.RunProcReturn("select * from Gy_Maintain where HItemID=" + HInterID, "Gy_Maintain");
                ds = oCN.RunProcReturn("select * from h_v_Gy_Maintain where HItemID=" + HInterID, "h_v_Gy_Maintain");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -180,6 +307,10 @@
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HModifyEmp = msg4;
                string HMaintainType = list[0].HMaintainType;
                long HUSEORGID = list[0].HUSEORGID;
                long HMaintainClassID = list[0].HMaintainClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Maintain_Edit", 1, false, msg4))
@@ -213,17 +344,69 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_Maintain set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HMaintainType='" + HMaintainType + "'" +
                    ",HModifyTime=getdate()" +
                     ",HUSEORGID='" + HUSEORGID + "'" +
                     ",HMaintainClassID='" + HMaintainClassID + "'" +
                    ",HShortNumber='" + HShortNumber + "'" +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HStopflag='" + HStopflag + "'" +
                    ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -254,7 +437,8 @@
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();
                string msg3 = sArray[1].ToString();//当前人
                string msg3 = sArray[2].ToString();//当前人
                string msg4 = sArray[1].ToString();
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
@@ -271,6 +455,11 @@
                string HUseFlag = list[0].HUseFlag;
                bool HEndFlag = list[0].HEndFlag;
                int HParentID = list[0].HParentID;
                string HMakeEmp = list[0].HMakeEmp;
                string HMaintainType = list[0].HMaintainType;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                long HMaintainClassID = list[0].HMaintainClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Maintain_Edit", 1, false, msg3))
@@ -295,14 +484,63 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert into Gy_Maintain " +
                   " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                   ",HLevel,HEndFlag,HStopflag,HRemark) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark" +
                 ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag,HMaintainType,HMaintainClassID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString()+","
                    + HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                    + HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'" +
                    ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ",'" + HUseFlag + "','" + HMaintainType + "',"+ HMaintainClassID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -322,7 +560,110 @@
        }
        #endregion
        #region ä¿å…»é¡¹ç›®å®¡æ ¸/反审核
        //#region ä¿å…»é¡¹ç›®å®¡æ ¸/反审核
        //[Route("Gy_Maintain/AuditGy_Maintain")]
        //[HttpGet]
        //public object AuditGy_Maintain(string HInterID, int Type, string user)
        //{
        //    try
        //    {
        //        //判断是否有审核权限
        //        if (!DBUtility.ClsPub.Security_Log("Gy_Maintain_Check", 1, false, user))
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "无权限审核!";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        if (string.IsNullOrWhiteSpace(HInterID))
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "HInterID为空!";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        DAL.ClsGy_Maintain_Ctl oBill = new DAL.ClsGy_Maintain_Ctl();
        //        ClsPub.CurUserName = user;
        //        oCN.BeginTran();//开始事务
        //        //Type 1 å®¡æ ¸  2  åå®¡æ ¸
        //        if (Type == 1)
        //        {
        //            //判断单据是否已经审核
        //            DataSet ds;
        //            string sql = "select * from  Gy_Maintain  where HItemID = " + HInterID;
        //            ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
        //            if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 0;
        //                objJsonResult.Message = "单据已审核!不能再次审核!";
        //                objJsonResult.data = null;
        //                return objJsonResult;
        //            }
        //            //审核单据
        //            if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 1;
        //                objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
        //                objJsonResult.data = null;
        //                return objJsonResult;
        //            }
        //        }
        //        else
        //        {
        //            //判断单据是否已经反审核
        //            DataSet ds;
        //            string sql = "select * from  Gy_Maintain  where HItemID = " + HInterID;
        //            ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
        //            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
        //            {
        //                if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
        //                {
        //                    objJsonResult.code = "0";
        //                    objJsonResult.count = 0;
        //                    objJsonResult.Message = "单据未审核!不需要反审核!";
        //                    objJsonResult.data = null;
        //                    return objJsonResult;
        //                }
        //                //反审核单据
        //                if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
        //                {
        //                    objJsonResult.code = "0";
        //                    objJsonResult.count = 1;
        //                    objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
        //                    objJsonResult.data = null;
        //                    return objJsonResult;
        //                }
        //            }
        //        }
        //        oCN.Commit();//提交事务
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 1;
        //        objJsonResult.Message = "执行成功!";
        //        objJsonResult.data = null;
        //        return objJsonResult; ;
        //    }
        //    catch (Exception e)
        //    {
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "执行失败!" + e.ToString();
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //}
        //#endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®å®¡æ ¸/反审核
        [Route("Gy_Maintain/AuditGy_Maintain")]
        [HttpGet]
        public object AuditGy_Maintain(string HInterID, int Type, string user)
@@ -366,6 +707,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核单据
                    if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
@@ -375,6 +739,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
@@ -393,6 +780,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制=========================================
                        ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_BeforeUnCheckCtrl");
                        if (ds == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        //反审核单据
                        if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
@@ -402,6 +812,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_AfterUnCheckCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                    }
                }
@@ -425,6 +858,191 @@
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_Maintain/StopGy_Maintain")]
        [HttpGet]
        public object StopGy_Maintain(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Maintain_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_Maintain where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_Maintain set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_Maintain set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¿å…»é¡¹ç›®æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_Maintain/Gy_Maintain_Excel")]
        [HttpPost]