Beispiel #1
0
        /// <summary>
        /// 新建线路
        /// </summary>
        /// <param name="lID">线路ID</param>
        /// <param name="lName">线路名称</param>
        /// <param name="lType">线路类型</param>
        /// <param name="lGw">线路岗位</param>
        /// <param name="lPID">线路父ID</param>
        public bool AddLineInfo(string lID, string lName, string lType, string lGw, string lPID, out string errMsg)
        {
            int    count = 1;
            object obj   = null;
            bool   flag  = false;

            //判断线路ID是否已被加入

            sql = "select * from T_BASE_ROUTE where T_ROUTEID='" + lID + "'";

            DataRow drBaseRoute = DBdb2.RunDataRow(sql, out errMsg);

            if (drBaseRoute != null)
            {
                errMsg = "此线路ID已被添加";
            }
            else
            {
                sql = "select count(*) from T_BASE_DEVICE";

                obj = DBdb2.GetSingle(sql);

                if (obj != null && obj.ToString() != "")
                {
                    count = int.Parse(obj.ToString()) + 1;
                }

                sql  = "insert into T_BASE_ROUTE (T_ROUTEID,T_ROUTENAME,T_ORGID,I_TYPE) values ('" + lID + "','" + lName + "','" + lGw + "'," + lType + ");";
                sql += "insert into T_BASE_DEVICE (T_NODEID,T_NODEKEY,T_PARAENTID) values ('" + lID + "','" + count.ToString() + "','" + lPID + "')";

                flag = DBdb2.RunNonQuery(sql, out errMsg);
            }

            return(flag);
        }
Beispiel #2
0
        /// <summary>
        /// 附件下载
        /// </summary>
        /// <param name="sbID"></param>
        /// <param name="sbName"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public byte[] RetBoolDownFile(string sbID, string sbName, out string errMsg)
        {
            byte[] File = null;

            DataRow dr = null;

            string fileName = sbName + ".doc";

            sql = "select B_ATTACHMENT from T_BASE_DEVICE where T_DEVICEID='" + sbID + "'";

            dr = DBdb2.RunDataRow(sql, out errMsg);

            try
            {
                if (dr != null)
                {
                    File = (byte[])dr[0];
                }
                else
                {
                    errMsg = "没有查询到相关纪录!";
                }
            }
            catch
            {
                errMsg = "此设备无附件可供下载!";
            }
            return(File);
        }
Beispiel #3
0
        /// <summary>
        /// 根据节点取得区域信息
        /// 只有count=3的时候才调用此方法
        /// count=3 代表点击的时区域
        /// </summary>
        /// <returns></returns>
        public DataRow RetDataRowAreaByNodeID(string AreaNodeKey)
        {
            //sql = "select b.T_AREAID,b.T_AREANAME,b.T_ROUTEID,i.T_NODEKEY,i.T_PARAENTID from T_BASE_AREA as b inner join T_INFO_ROUTE as i on b.T_AREAID=i.T_NODEID where T_NODEKEY='" + AreaNodeKey + "'";

            sql = "select b.T_AREAID,b.t_areacd,b.T_AREANAME,b.T_ROUTEID,i.T_NODEKEY,i.T_PARAENTID from T_BASE_AREA as b inner join T_INFO_ROUTE as i on b.T_AREAID=i.T_NODEID where T_NODEKEY='" + AreaNodeKey + "' and T_desc='QY'";

            return(DBdb2.RunDataRow(sql, out errMsg));
        }
Beispiel #4
0
        /// <summary>
        /// 获取点检项信息
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <returns></returns>
        public DataRow RetItemInfoByNodeKey(string nodeKey)
        {
            sql = "select * from  (select rank() over( partition by T_ITEMID order by T_STARTTIME desc ) rk,b.* from ";

            sql += "(SELECT * FROM T_INFO_ROUTE as i INNER JOIN T_BASE_ITEM as b ON b.T_ITEMID =i.T_NODEID where i.T_DESC ='DJX' and i.T_NODEKEY='" + nodeKey + "' ) as b) as y where y.rk<=1";

            return(DBdb2.RunDataRow(sql, out errMsg));
        }
Beispiel #5
0
        /// <summary>
        /// 新建线路
        /// </summary>
        /// <param name="lName">线路名称</param>
        /// <param name="lType">线路类型</param>
        /// <param name="lGw">线路岗位</param>
        /// <param name="lPID">线路父ID</param>
        public bool AddLineInfo(string lName, string lType, string lGw, string lPID, out string errMsg)
        {
            int    count = 1;
            object obj   = null;
            bool   flag  = false;

            sql = "select * from T_BASE_ROUTE as b inner join T_INFO_ROUTE as i on b.T_ROUTEID=i.T_NODEID where i.T_NODEKEY='" + lPID + "'";

            DataRow drIS = DBdb2.RunDataRow(sql, out errMsg);

            if (drIS == null)
            {
                sql = "select * from T_BASE_ROUTE where T_ROUTENANME='" + lName + "'";

                DataRow dr = DBdb2.RunDataRow(sql, out errMsg);

                if (dr == null)
                {
                    int countBase = 1;

                    sql = "select T_ROUTEID from T_BASE_ROUTE order by ID_KEY DESC fetch first 1 rows only ";// "select * from T_BASE_ROUTE where T_ROUTENAME='" + lName + "'";

                    obj = DBdb2.RunSingle(sql, out errMsg);

                    if (obj != null && obj.ToString() != "")
                    {
                        countBase = int.Parse(obj.ToString()) + 1;
                    }

                    sql = "select T_NODEKEY from T_INFO_ROUTE order by ID_KEY DESC fetch first 1 rows only ";

                    obj = DBdb2.GetSingle(sql);

                    if (obj != null && obj.ToString() != "")
                    {
                        count = int.Parse(obj.ToString()) + 1;
                    }

                    sql = "insert into T_BASE_ROUTE (T_ROUTEID,T_ROUTENAME,T_ORGID,I_TYPE) values ('" + countBase + "','" + lName + "','" + lGw + "'," + lType + ")";
                    string sql1 = "insert into T_INFO_ROUTE (T_NODEID,T_NODEKEY,T_PARAENTID,T_DESC) values ('" + countBase + "','" + count.ToString() + "','" + lPID + "','XL')";

                    flag = DBdb2.RunNonQuery(sql, out errMsg);
                    DBdb2.RunNonQuery(sql1, out errMsg);
                }
                else
                {
                    errMsg = "此线路已被添加!";
                }
            }
            else
            {
                errMsg = "线路下不允许在新建线路!";
            }
            return(flag);
        }
Beispiel #6
0
        /// <summary>
        /// 获取设备名称
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <returns></returns>
        public DataRow RetSBNameBySbNodeKey1(string nodeKey)
        {
            string str = "";

            sql = "select * from T_INFO_ROUTE as r inner join T_BASE_DEVICE as d on r.T_NODEID=d.T_DEVICEID where T_NODEKEY='" + nodeKey + "'";

            DataRow dr = DBdb2.RunDataRow(sql, out errMsg);


            return(dr);
        }
Beispiel #7
0
        /// <summary>
        /// 获取设备名称
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <returns></returns>
        public string RetSBNameBySbNodeKey(string nodeKey)
        {
            string str = "";

            sql = "select * from T_INFO_ROUTE as r inner join T_BASE_DEVICE as d on r.T_NODEID=d.T_DEVICEID where T_NODEKEY='" + nodeKey + "'";

            DataRow dr = DBdb2.RunDataRow(sql, out errMsg);

            if (dr != null)
            {
                str = dr["T_DEVICEDESC"].ToString();
            }


            return(str);
        }
Beispiel #8
0
        /// <summary>
        /// 根据节点取得线路信息
        /// 只有count=2的时候才调用此方法
        /// count=2 代表点击的时线路
        /// </summary>
        /// <returns></returns>
        public DataRow RetDataRowByNodeID(string nodeID)
        {
            DataRow dr = null;

            sql = "select b.T_ORGID,b.T_ROUTEID from T_INFO_ROUTE as i inner join T_BASE_ROUTE as b on i.T_NODEID=b.T_ROUTEID where T_NODEKEY='" + nodeID + "'";

            dr = DBdb2.RunDataRow(sql, out errMsg);

            if (dr != null)
            {
                sql = "SELECT * FROM T_BASE_ROUTE as r inner join T_SYS_ORGANIZE as o on r.T_ORGID=o.T_ORGID where  r.T_ORGID='" + dr["T_ORGID"] + "' and r.T_ROUTEID='" + dr["T_ROUTEID"] + "'";

                dr = DBdb2.RunDataRow(sql, out errMsg);
            }

            return(dr);
        }
Beispiel #9
0
        /// <summary>
        /// 更改设备状态调用接口
        /// </summary>
        /// <param name="sbID"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool RetUpdateDveiceStatus(string sbID, string time, out string errMsg)
        {
            bool flag = false;

            DataRow drRou  = null;
            DataRow drDev  = null;
            DataRow drArea = null;

            sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEID='" + sbID + "'";

            drDev = DBdb2.RunDataRow(sql, out errMsg);

            if (drDev != null)
            {
                sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drDev["T_PARAENTID"] + "'";

                drArea = DBdb2.RunDataRow(sql, out errMsg);

                if (drArea != null)
                {
                    sql   = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drArea["T_PARAENTID"] + "'";
                    drRou = DBdb2.RunDataRow(sql, out errMsg);

                    if (drRou != null)
                    {
                        sql = "select * from (select rank() over(partition by T_ITEMID order by T_STARTTIME desc) rk,b.* from T_BASE_ITEM as b where b.T_DeviceID ='" + sbID + "') as y where y.rk<=1;";

                        DataTable dtItems = DBdb2.RunDataTable(sql, out errMsg);

                        //创建点检项关系 0 删除点检项关系 1 编辑点检项 2  编辑设备状态3
                        this.RetBoolDYJK(drRou["T_NODEID"].ToString(), drArea["T_NODEID"].ToString(), drDev["T_NODEID"].ToString(), "3", time, dtItems, out errMsg);
                    }
                    else
                    {
                        errMsg = "没有找到线路ID";
                    }
                }
                else
                {
                    errMsg = "没有找到区域ID";
                }
            }

            return(flag);
        }
Beispiel #10
0
        public DataRow ReadItem(string id_key)
        {
            DataRow dr = null;



            sql = "select * from T_BASE_ITEM  where ID_KEY=" + id_key + "";

            dr = DBdb2.RunDataRow(sql, out errMsg);

            //if (dr != null)
            //{
            //    sql = "SELECT * FROM T_BASE_ROUTE as r inner join T_SYS_ORGANIZE as o on r.T_ORGID=o.T_ORGID where  r.T_ORGID='" + dr["T_ORGID"] + "' and r.T_ROUTEID='" + dr["T_ROUTEID"] + "'";

            //    dr = DBdb2.RunDataRow(sql, out errMsg);
            //}

            return(dr);
        }
Beispiel #11
0
        /// <summary>
        /// 根据节点取得线路信息
        /// 只有count=2的时候才调用此方法
        /// count=2 代表点击的时线路
        /// </summary>
        /// <returns></returns>
        public DataRow ReadDeviceInfo(string deviceID)
        {
            DataRow dr = null;



            sql = "select * from T_BASE_DEVICE  where T_DEVICEID='" + deviceID + "'";

            dr = DBdb2.RunDataRow(sql, out errMsg);

            //if (dr != null)
            //{
            //    sql = "SELECT * FROM T_BASE_ROUTE as r inner join T_SYS_ORGANIZE as o on r.T_ORGID=o.T_ORGID where  r.T_ORGID='" + dr["T_ORGID"] + "' and r.T_ROUTEID='" + dr["T_ROUTEID"] + "'";

            //    dr = DBdb2.RunDataRow(sql, out errMsg);
            //}

            return(dr);
        }
Beispiel #12
0
        /// <summary>
        /// 获取ITEM详细信息
        /// </summary>
        /// <param name="ID_KEY">ID_KEY</param>
        /// <returns></returns>
        public DataTable RetTabItemsByIDKEY(string ID_KEY)
        {
            DataTable dt = null;
            DataRow   dr = null;

            sql = "select T_ITEMID,T_DeviceID from T_BASE_ITEM where ID_KEY=" + ID_KEY;

            dr = DBdb2.RunDataRow(sql, out errMsg);

            if (dr != null)
            {
                sql = "select * from T_BASE_ITEM where T_ITEMID='" + dr["T_ITEMID"] + "' and T_DEVICEID='" + dr["T_DEVICEID"] + "' order by T_STARTTIME desc";

                dt = DBdb2.RunDataTable(sql, out errMsg);
            }

            //sql = "select * from T_BASE_ITEM where T_ITEMID in (select T_ITEMID from T_BASE_ITEM where ID_KEY="+ID_KEY+")  order by T_STARTTIME desc";

            return(dt);
        }
Beispiel #13
0
        /// <summary>
        /// 添加,编辑设备和点检项关联信息
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <param name="oArea">删除的纪录</param>
        /// <param name="iArea">添加的纪录</param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool AddDeviceAndItemRealtion(string nodeKey, string[] oArea, string[] iArea, out string errMsg)
        {
            int    oCou  = 0;
            int    iCou  = 0;
            int    count = 0;
            bool   flag  = false;
            object obj   = null;

            DataRow drRou  = null;
            DataRow drDev  = null;
            DataRow drArea = null;

            errMsg = "";

            //查询线路区域设备ID
            PlanDAL pd = new PlanDAL();

            sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + nodeKey + "'";

            drDev = DBdb2.RunDataRow(sql, out errMsg);

            if (drDev != null)
            {
                sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drDev["T_PARAENTID"] + "'";

                drArea = DBdb2.RunDataRow(sql, out errMsg);

                if (drArea != null)
                {
                    sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drArea["T_PARAENTID"] + "' and T_DESC='XL'";

                    drRou = DBdb2.RunDataRow(sql, out errMsg);

                    #region  除点检项关系
                    if (oArea != null)
                    {
                        string[] route    = new string[oArea.Length];
                        string[] area     = new string[oArea.Length];
                        string[] device   = new string[oArea.Length];
                        string[] item     = new string[oArea.Length];
                        int[]    judge    = new int[oArea.Length]; //操作类型:创建点检项关系 删除点检项关系 编辑点检项  编辑设备状态
                        string[] sTimes   = new string[oArea.Length];
                        string[] type     = new string[oArea.Length];
                        string[] count1   = new string[oArea.Length];
                        string[] devState = new string[oArea.Length];
                        string[] state    = new string[oArea.Length];

                        for (int i = 0; i < oArea.Length; i++)
                        {
                            route[i]  = drRou["T_NODEID"].ToString();
                            area[i]   = drArea["T_NODEID"].ToString();
                            device[i] = drDev["T_NODEID"].ToString();

                            sql = "select * from T_BASE_ITEM where ID_KEY=" + oArea[i];

                            DataRow drItem = DBdb2.RunDataRow(sql, out errMsg);

                            if (drItem != null)
                            {
                                item[i]     = drItem["T_ITEMID"].ToString();
                                judge[i]    = 1;                                  //操作类型:创建点检项关系 0 删除点检项关系 1 编辑点检项 2  编辑设备状态3
                                sTimes[i]   = drItem["T_STARTTIME"].ToString();   // itemStartTime; //T_STARTTIME
                                type[i]     = drItem["T_PERIODTYPE"].ToString();  //itemPerType;  //T_PERIODTYPE
                                count1[i]   = drItem["T_PERIODVALUE"].ToString(); // itemPerValue;//T_PERIODVALUE
                                devState[i] = drItem["I_STATUS"].ToString();      // itemStatus;//I_STATUS
                                state[i]    = drItem["T_STATUS"].ToString();      // itemStatusQJ;//T_STATUS

                                sql = "delete from T_INFO_ROUTE where T_PARAENTID='" + nodeKey + "' and T_NODEID='" + drItem["T_ITEMID"].ToString() + "' and T_DESC='DJX'";

                                int j = DBdb2.RunCommand(sql, out errMsg);

                                if (j > 0)
                                {
                                    oCou = 1;
                                }
                            }
                        }

                        flag = pd.EditRelation(route[0], area[0], device[0], item, judge);// qc.ManageQuestcomplete(route, area, device, item, judge, sTimes, type, count1, devState, state);

                        //public bool EditRelation(string routeID, string areaID, string deviceID, string[] items, int[] judge)
                    }
                    else
                    {
                        oCou = 1;
                    }
                    #endregion

                    #region 添加点检项关系
                    if (iArea != null)
                    {
                        string[] route    = new string[iArea.Length];
                        string[] area     = new string[iArea.Length];
                        string[] device   = new string[iArea.Length];
                        string[] item     = new string[iArea.Length];
                        int[]    judge    = new int[iArea.Length]; //操作类型:创建点检项关系 删除点检项关系 编辑点检项  编辑设备状态
                        string[] sTimes   = new string[iArea.Length];
                        string[] type     = new string[iArea.Length];
                        string[] count1   = new string[iArea.Length];
                        string[] devState = new string[iArea.Length];
                        string[] state    = new string[iArea.Length];

                        for (int i = 0; i < iArea.Length; i++)
                        {
                            route[i]  = drRou["T_NODEID"].ToString();
                            area[i]   = drArea["T_NODEID"].ToString();
                            device[i] = drDev["T_NODEID"].ToString();

                            sql = "select * from T_BASE_ITEM where ID_KEY=" + iArea[i];

                            DataRow drItem = DBdb2.RunDataRow(sql, out errMsg);

                            if (drItem != null)
                            {
                                item[i]     = drItem["T_ITEMID"].ToString();
                                judge[i]    = 0;                                  //操作类型:创建点检项关系 0 删除点检项关系 1 编辑点检项 2  编辑设备状态3
                                sTimes[i]   = drItem["T_STARTTIME"].ToString();   // itemStartTime; //T_STARTTIME
                                type[i]     = drItem["T_PERIODTYPE"].ToString();  //itemPerType;  //T_PERIODTYPE
                                count1[i]   = drItem["T_PERIODVALUE"].ToString(); // itemPerValue;//T_PERIODVALUE
                                devState[i] = drItem["I_STATUS"].ToString();      // itemStatus;//I_STATUS
                                state[i]    = drItem["T_STATUS"].ToString();      // itemStatusQJ;//T_STATUS

                                sql = "select T_NODEKEY from T_INFO_ROUTE order by ID_KEY DESC fetch first 1 rows only ";

                                obj = DBdb2.GetSingle(sql);

                                if (obj != null && obj.ToString() != "")
                                {
                                    count = int.Parse(obj.ToString()) + 1;
                                }

                                sql = "insert into T_INFO_ROUTE (T_NODEID,T_NODEKEY,T_PARAENTID,T_DESC) values ('" + drItem["T_ITEMID"].ToString() + "','" + count + "','" + nodeKey + "','DJX')";

                                int j = DBdb2.RunCommand(sql, out errMsg);

                                if (j > 0)
                                {
                                    iCou = 1;
                                }
                            }
                        }

                        flag = pd.EditRelation(route[0], area[0], device[0], item, judge);
                        //flag = qc.ManageQuestcomplete(route, area, device, item, judge, sTimes, type, count1, devState, state);
                    }
                    else
                    {
                        iCou = 1;
                    }

                    #endregion

                    if (iCou == 1 && oCou == 1)
                    {
                    }
                    else
                    {
                        errMsg = "无论新增或删除设备和点检项关系,有一项失败!";
                    }
                }
            }
            return(flag);
        }
Beispiel #14
0
        /// <summary>
        /// 添加设备和点检项关系
        /// 添加点检项记录
        /// 调用任务生成接口
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <param name="itemID"></param>
        /// <param name="itemBw"></param>
        /// <param name="itemDesc"></param>
        /// <param name="itemContent"></param>
        /// <param name="itemObserve"></param>
        /// <param name="itemUnit"></param>
        /// <param name="itemType"></param>
        /// <param name="itemStatus"></param>
        /// <param name="itemStatusQJ"></param>
        /// <param name="itemUpper"></param>
        /// <param name="itemLower"></param>
        /// <param name="itemSpectrum"></param>
        /// <param name="itemStartTime"></param>
        /// <param name="itemPerValue"></param>
        /// <param name="itemPerType"></param>
        /// <returns></returns>
        public bool AddItem(string nodeKey, string itemBw, string itemDesc, string itemContent, string itemObserve, string itemUnit, string itemType, string itemStatus, string itemStatusQJ, string itemUpper, string itemLower, string itemSpectrum, string itemStartTime, string itemPerValue, string itemPerType, out string errMsg)
        {
            object obj   = null;
            bool   flag  = false;
            int    count = 0;

            //添加 T_INFO_ROUTE 信息
            sql = "select T_NODEKEY from T_INFO_ROUTE order by ID_KEY DESC fetch first 1 rows only ";

            obj = DBdb2.GetSingle(sql);

            if (obj != null && obj.ToString() != "")
            {
                count = int.Parse(obj.ToString()) + 1;
            }

            sql = "insert into T_INFO_ROUTE (T_NODEID,T_NODEKEY,T_PARAENTID) values ('1','" + count + "','" + nodeKey + "')";

            flag = DBdb2.RunNonQuery(sql, out errMsg);

            if (flag == true)
            {
                sql = "select T_NODEID from T_INFO_ROUTE where T_NODEKEY='" + nodeKey + "'";

                obj = DBdb2.RunSingle(sql, out errMsg);

                if (obj != null && obj.ToString() != "")
                {
                    sql  = "insert into T_BASE_ITEM ";
                    sql += "(T_ITEMPOSITION,T_ITEMDESC,T_CONTENT,T_TYPE,I_STATUS,T_OBSERVE,T_UNIT,F_LOWER,F_UPPER,I_SPECTRUM,T_DEVICEID,T_STARTTIME,T_PERIODTYPE,T_PERIODVALUE,T_STATUS)";
                    sql += " values ";
                    sql += "('" + itemBw + "','" + itemDesc + "','" + itemContent + "','" + itemType + "'," + itemStatus + ",'" + itemObserve + "','" + itemUnit + "'," + double.Parse(itemLower) + "," + double.Parse(itemUpper) + "," + int.Parse(itemSpectrum) + ",'" + obj.ToString() + "','" + DateTime.Parse(itemStartTime).ToString("yyyy-MM-dd 0:00:00") + "'," + int.Parse(itemPerType) + "," + int.Parse(itemPerValue) + "," + int.Parse(itemStatusQJ) + ")";

                    flag = DBdb2.RunNonQuery(sql, out errMsg);

                    if (flag == true)
                    {
                        //调用接口生成任务
                        //ManageQuestcomplete(string[] routeId, string[] area, string[] deviceId, string[] itemId, string[] judge, string[] sTimes, string[] type, string[] count, string[] deviceState, string[] state)
                        string[] route    = new string[1];
                        string[] area     = new string[1];
                        string[] device   = new string[1];
                        string[] item     = new string[1];
                        string[] judge    = new string[1]; //操作类型:创建点检项关系 删除点检项关系 编辑点检项  编辑设备状态
                        string[] sTimes   = new string[1];
                        string[] type     = new string[1];
                        string[] count1   = new string[1];
                        string[] devState = new string[1];
                        string[] state    = new string[1];

                        DataRow drRou  = null;
                        DataRow drDev  = null;
                        DataRow drArea = null;

                        sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + nodeKey + "'";

                        drDev = DBdb2.RunDataRow(sql, out errMsg);

                        if (drDev != null)
                        {
                            sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drDev["T_PARAENTID"] + "'";

                            drArea = DBdb2.RunDataRow(sql, out errMsg);

                            if (drArea != null)
                            {
                                sql = "SELECT T_NODEID,T_PARAENTID FROM T_INFO_ROUTE where T_NODEKEY='" + drArea["T_PARAENTID"] + "' and T_DESC='XL'";

                                drRou = DBdb2.RunDataRow(sql, out errMsg);
                            }

                            route[0]    = drRou["T_NODEID"].ToString();
                            area[0]     = drArea["T_NODEID"].ToString();
                            device[0]   = drDev["T_NODEID"].ToString();
                            item[0]     = "1";           //itemID;
                            judge[0]    = "0";           //操作类型:创建点检项关系 0 删除点检项关系 1 编辑点检项 2  编辑设备状态3
                            sTimes[0]   = itemStartTime; //T_STARTTIME
                            type[0]     = itemPerType;   //
                            count1[0]   = itemPerValue;
                            devState[0] = itemStatus;
                            state[0]    = itemStatusQJ;
                        }

                        flag = qc.ManageQuestcomplete(route, area, device, item, judge, sTimes, type, count1, devState, state);
                    }
                    else
                    {
                        errMsg = "新建点检项失败!";
                    }
                }
            }
            else
            {
                errMsg = "添加T_INFO_ROUTE表关系错误!";
            }

            return(flag);
        }
Beispiel #15
0
        /// <summary>
        /// 根据节点取得区域信息
        /// 只有count=4的时候才调用此方法
        /// count=4 代表点击的时区域
        /// </summary>
        /// <returns></returns>
        public DataRow RetDataRowDeviceByNodeID(string NodeKey)
        {
            sql = "select b.T_AREAID,b.T_AREANAME,b.T_ROUTEID,i.T_NODEKEY,i.T_PARAENTID from T_BASE_AREA as b inner join T_INFO_ROUTE as i on b.T_AREAID=i.T_NODEID where T_NODEKEY='" + NodeKey + "'";

            return(DBdb2.RunDataRow(sql, out errMsg));
        }
Beispiel #16
0
 public DataRow RetDataRowLineByAreaNodeKey(string AreaNodeKey)
 {
     //sql = "select b.T_ROUTEID,b.T_ROUTENAME from T_BASE_ROUTE as b inner join T_INFO_ROUTE as i on b.T_ROUTEID=i.T_NODEID where T_NODEKEY='" + AreaNodeKey + "'";
     sql = "select b.T_ROUTEID,b.T_ROUTENAME from T_BASE_ROUTE as b inner join T_INFO_ROUTE as i on b.T_ROUTEID=i.T_NODEID where T_NODEKEY=(select T_PARAENTID from T_INFO_ROUTE where T_NODEKEY='" + AreaNodeKey + "')";
     return(DBdb2.RunDataRow(sql, out errMsg));
 }
Beispiel #17
0
        /// <summary>
        /// 获取设备表中跟目录中第一条
        /// </summary>
        /// <param name="errMsg"></param>
        /// <returns>deviceDesc + ',' + file + ',' + status;</returns>
        public string GetDrDevByTopOne(string sbID, out string errMsg)
        {
            string status     = "无";
            string deviceDesc = "";
            string file       = "无";

            string whgc = "";
            string jhgc = "";
            string cbzx = "";
            string scbs = "";
            string sbyy = "";
            string djzt = "";
            string fjbm = "";
            string sql  = "";

            if (sbID == "")
            {
                sql = "select * from T_BASE_DEVICE where T_PARENTID not in (select T_DEVICEID from T_BASE_DEVICE)";// "select * from T_BASE_Device order by ID_KEY fetch first 1 rows only";
            }
            else
            {
                sql = "select * from T_BASE_Device where T_DEVICEID='" + sbID + "' order by ID_KEY fetch first 1 rows only ";
            }


            DataRow dr = DBdb2.RunDataRow(sql, out errMsg);

            if (dr != null)
            {
                deviceDesc = dr["T_DEVICEDESC"].ToString();

                if (dr["B_ATTACHMENT"] != null && dr["B_ATTACHMENT"].ToString() != "")
                {
                    file = "有";
                }

                sql = "SELECT * FROM T_Info_DEVICE  as d inner join T_BASE_STATUS as s on d.I_STATUS=s.I_STATUSID where d.T_DEVICEID='" + dr["T_DEVICEID"].ToString() + "' order by d.T_Time desc fetch first 1 rows only";

                DataRow drS = DBdb2.RunDataRow(sql, out errMsg);

                if (drS != null)
                {
                    status = drS["T_STATUSDESC"].ToString();
                }

                if (dr["T_SWERK"] != null)
                {
                    whgc = dr["T_SWERK"].ToString();
                }
                else
                {
                    whgc = "";
                }

                if (dr["T_IWERK"] != null)
                {
                    jhgc = dr["T_IWERK"].ToString();
                }
                else
                {
                    jhgc = "";
                }

                if (dr["T_KOSTL"] != null)
                {
                    cbzx = dr["T_KOSTL"].ToString();
                }
                else
                {
                    cbzx = "";
                }

                if (dr["T_SCBS"] != null)
                {
                    scbs = dr["T_SCBS"].ToString();
                }
                else
                {
                    scbs = "";
                }

                if (dr["T_FHZT"] != null)
                {
                    if (dr["T_FHZT"].ToString() == "0")
                    {
                        djzt = "数据成功传到点检";
                    }
                    else if (dr["T_FHZT"].ToString() == "1")
                    {
                        djzt = "SAP与ESB连接失败";
                    }
                    else if (dr["T_FHZT"].ToString() == "2")
                    {
                        djzt = "ESB与中间件连接失败";
                    }
                    else if (dr["T_FHZT"].ToString() == "3")
                    {
                        djzt = "中间件与点检连接失败";
                    }
                    else if (dr["T_FHZT"].ToString() == "4")
                    {
                        djzt = "点检更新失败";
                    }
                    else if (dr["T_FHZT"].ToString() == "5")
                    {
                        djzt = "点检更新成功";
                    }
                }
                else
                {
                    djzt = "";
                }

                if (dr["T_SBYY"] != null)
                {
                    sbyy = dr["T_SBYY"].ToString();
                }
                else
                {
                    sbyy = "";
                }

                fjbm = dr["t_parentid"].ToString();
            }

            return(deviceDesc + ',' + file + ',' + status + ',' + whgc + ',' + jhgc + ',' + cbzx + ',' + scbs + ',' + djzt + ',' + sbyy + ',' + fjbm);
        }
Beispiel #18
0
        /// <summary>
        /// 根据设备标识获取设备信息
        /// </summary>
        /// <param name="treeID"></param>
        /// <returns></returns>
        public DataRow RetdrBySBID(string treeID)
        {
            sql = "select * from T_BASE_DEVICE where T_DEVICEID='" + treeID + "'";

            return(DBdb2.RunDataRow(sql, out errMsg));
        }
Beispiel #19
0
        /// <summary>
        /// 根据ID
        /// </summary>
        /// <param name="stID"></param>
        /// <returns></returns>
        public DataRow RetDrByStatusID(string stID)
        {
            sql = "select * from T_BASE_STATUS where I_STATUSID =" + stID;

            return(DBdb2.RunDataRow(sql, out errMsg));
        }