yusijie
2025-06-03 01685f3ab68f64b51b83eee40af90f4030866691
WebAPI/Controllers/WebAPIController.cs
@@ -14803,7 +14803,7 @@
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
                    //ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
@@ -14812,21 +14812,32 @@
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("Select HItemID from Gy_PreventErrMould  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_PreventErrMould");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码重复!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        //if (ds == null || ds.Tables[0].Rows.Count == 0)
                        //{
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "保存失败!代码重复!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //}
                        //else
                        //{
                        //    objJsonResult.code = "0";
                        //    objJsonResult.count = 0;
                        //    objJsonResult.Message = "保存失败!代码重复!";
                        //    objJsonResult.data = 1;
                        //    return objJsonResult;
                        //}
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -14852,6 +14863,18 @@
                    }
                    else//编辑时判断
                    {
                        //已审核不允许修改
                        DataSet dss;
                        dss = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + oItem.HItemID, "Gy_PreventErrMould");
                        //判断是否可编辑
                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据状态已经审核,不允许修改!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -15441,7 +15464,7 @@
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem");
                    //ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
@@ -15450,21 +15473,21 @@
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("Select HItemID from Gy_CheckNoteItem  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_CheckNoteItem");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码重复!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "保存失败!代码重复!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -15490,6 +15513,18 @@
                    }
                    else//编辑时判断
                    {
                        //已审核不允许修改
                        DataSet dss;
                        dss = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HItemID=" + oItem.HItemID, "Gy_CheckNoteItem");
                        //判断是否可编辑
                        if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据状态已经审核,不允许修改!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
@@ -18565,7 +18600,7 @@
                ClsCN oCn = new ClsCN();
                DataSet oDs = new DataSet();
                //==========
                oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS", "Xt_ORGANIZATIONS");
                oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS with(nolock)", "Xt_ORGANIZATIONS");
                objjson.code = "1";
                objjson.count = 1;
                objjson.Message = "获取成功!";
@@ -19295,6 +19330,51 @@
        }
        /// <summary>
        /// 获取巡检项目列表
        /// </summary>
        /// <returns></returns>
        [Route("Web/GetPatrolCheckItemList_Json")]
        [HttpGet]
        public object GetPatrolCheckItemList_Json(string CheckItem)
        {
            DataSet ds;
            try
            {
                sWhere = " Where HStopFlag=0 and HEndFlag=1";
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if(CheckItem != "" && CheckItem != null)
                {
                    sWhere = sWhere + " and ( HNumber like '%" + CheckItem + "%' or HName like '%" + CheckItem + "%' ) ";
                }
                ds = oCN.RunProcReturn("Select HItemID,HNumber,HName  from Gy_PatrolCheck " + sWhere + " Order by HItemID ", "Gy_DotCheck");
                if(ds == null )
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo;
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "1";
                    objjson.count = 1;
                    objjson.Message = "获取成功";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch(Exception ex)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + ex.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        /// <summary>
@@ -20505,6 +20585,9 @@
                    case "QD":
                        HView = "h_v_Sb_EquipRepairSignBillList";
                        break;
                    case "XJ":
                        HView = "h_v_Sb_EquipPatrolCheckBillList";
                        break;
                    default:
                        objjson.code = "0";
                        objjson.count = 0;
@@ -21189,18 +21272,36 @@
        //获取所有模块页面
        [Route("Web/ModePageList")]
        [HttpGet]
        public object ModePageList()
        public object ModePageList(string HMakeName, string HType)
        {
            try
            {
               
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where isnull(Hurl,'')  like'%html%'  Order by HItemID ", "Gy_Menu");     //获取Gy_Menu_1中的所有菜单信息,用于为menuInitList列表充
                string sql = "select *  from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' and isnull(Hurl,'')  like'%html%' order by HPosition";
                ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //查询当前用户的自定义菜单数据
                if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //判断当前用户是否有设置过自定义信息,若记录数为0,则没有设置过,加载所有的菜单信息
                {
                    string sql1 = "select * from Gy_MenuDefineSet  where HMakeName=" +
                        "(select   top 1 c.GroupName  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId  " +
                        "left join System_UserGroup c on b.GroupId = c.GroupID  where a.Czymc ='" + HMakeName + "' order by len(c.GroupName )) and isnull(Hurl,'')  like'%html%'";
                    ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");        //查询用户绑定的角色 是否设置菜单信息 取角色名称最短的一个
                    if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
                    {
                        sql = "Select * from h_v_Gy_Menu_1   Order by HPosition,len(HitemID),HitemID  ";
                        ds = oCn.RunProcReturn(sql, "Gy_Menu_1");
                    }
                }
                //ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where isnull(Hurl,'')  like'%html%'  Order by HItemID ", "Gy_Menu_1");     //获取Gy_Menu_1中的所有菜单信息,用于为menuInitList列表充
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)