Example #1
0
        /// <summary>
        /// 设置采集点信息
        /// </summary>
        /// <returns></returns>
        public APIRst SetModuleFun(ModuleFunVModel fun)
        {
            APIRst rst = new APIRst();

            try
            {
                rst.data = bll.SetModuleFun(fun);
            }
            catch (Exception ex)
            {
                rst.rst      = false;
                rst.err.code = (int)ResultCodeDefine.Error;
                rst.err.msg  = ex.Message;
                FileLog.WriteLog("设置采集点信息:" + ex.Message + ex.StackTrace);
            }
            return(rst);
        }
Example #2
0
        /// <summary>
        /// 设置采集点信息
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        public int SetModuleFun(ModuleFunVModel fun)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Clear();
            strSql.Append("select count(*) from v0_fun where Ledger=@Ledger and Fun_id!=@Fun_id and FunType=@FunType");
            object obj = SQLHelper.ExecuteScalar(strSql.ToString(), new { Ledger = this.Ledger, Fun_id = fun.Fun_id, FunType = fun.FunType });

            if (CommFunc.ConvertDBNullToInt32(obj) > 0)
            {
                throw new Exception("已存在此采集点型号:" + fun.FunType);
            }
            if (fun.ModuleTypeId == 0)
            {
                throw new Exception("已存在此采集类型ID号为空");
            }
            if (fun.Fun_id == 0)
            {
                strSql.Clear();
                strSql.Append("select max(Fun_id)as cnt from v0_fun where Ledger=@Ledger");
                fun.Fun_id = CommFunc.ConvertDBNullToInt32(SQLHelper.ExecuteScalar(strSql.ToString(), new { Ledger = this.Ledger })) + 1;
            }
            //
            strSql.Clear();
            strSql.Append("select count(a.Ledger)as cnt from v0_fun as a inner join v2_info as b on a.Ledger=b.Ledger and a.Fun_id=b.Fun_id");
            strSql.Append(" where a.Ledger=@Ledger and a.Mm_id=@Mm_id and a.Fun_id=@Fun_id limit 1");
            obj = SQLHelper.ExecuteScalar(strSql.ToString(), new { Ledger = this.Ledger, Mm_id = fun.ModuleTypeId, Fun_id = fun.Fun_id });
            if (CommFunc.ConvertDBNullToInt32(obj) > 0)
            {
                throw new Exception("此采集点型号:" + fun.FunType + "已经有采集数据不能修改");
            }
            //
            object params01 = new { Ledger = this.Ledger, Mm_id = fun.ModuleTypeId, Fun_id = fun.Fun_id, FunType = fun.FunType, FunName = fun.FunName, Disabled = 0 };

            strSql.Clear();
            strSql.Append("insert into v0_fun(Ledger,Fun_id,Mm_id,FunName,FunType,Action,Scale,Disabled,SubTab)");
            strSql.Append(" values (@Ledger, @Fun_id, @Mm_id, @FunName, @FunType, 0, 2, 0, @FunType)");
            strSql.Append("ON DUPLICATE KEY UPDATE FunType=@FunType,FunName=@FunName,SubTab=@FunType;");
            return(SQLHelper.Execute(strSql.ToString(), params01));
        }
Example #3
0
 public APIRst SetModuleFun(ModuleFunVModel fun)
 {
     return(infoHelper.SetModuleFun(fun));
 }
Example #4
0
 public APIRst AddModuleFun(ModuleFunVModel fun)
 {
     fun.Fun_id = 0;
     return(infoHelper.SetModuleFun(fun));
 }
Example #5
0
 /// <summary>
 /// 设置采集点信息
 /// </summary>
 /// <param name="fun"></param>
 /// <returns></returns>
 public int SetModuleFun(ModuleFunVModel fun)
 {
     return(dal.SetModuleFun(fun));
 }