/// <summary>
        /// 判断下位机是否和其他设备有关系
        /// </summary>
        /// <param name="subordinateId">下位机id</param>
        /// <returns></returns>
        public bool HasRelation(string subordinateId)
        {
            try
            {
                Log.Info("BllDEV_SUBORDINATE_INFO->HasRelation---START");

                bool result = false;

                //声明一个变量
                DataSet dstemp = new DataSet();

                ConnectionOpen();

                //工作站和线圈电源关系
                DalDEV_LOAD_TO_SUB dalDevLoadToSub = new DalDEV_LOAD_TO_SUB();

                dalDevLoadToSub.SetDBAccess(GetDBAccess());


                dstemp = dalDevLoadToSub.GetList("F_SUBORDINATE_ID='" + subordinateId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }


                //工作站和下位机关系
                DalDEV_WORK_TO_SUB dalDevWorkToSub = new DalDEV_WORK_TO_SUB();

                dalDevWorkToSub.SetDBAccess(GetDBAccess());


                dstemp = dalDevWorkToSub.GetList("F_SUBORDINATE_ID='" + subordinateId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }



                return(result);
            }
            catch (Exception ex)
            {
                Log.Error("BllDEV_SUBORDINATE_INFO->HasRelation---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllDEV_SUBORDINATE_INFO->HasRelation---finally");
            }
        }
Example #2
0
        /// <summary>
        /// 判断上位机是否和其他设备有关系
        /// </summary>
        /// <param name="workstationId">工作站id</param>
        /// <returns></returns>
        public bool HasRelation(string workstationId)
        {
            try
            {
                Log.Info("BllDEV_WORKSTATION_INFO->HasRelation---START");

                bool result = false;

                //声明一个变量
                DataSet dstemp = new DataSet();

                ConnectionOpen();

                //工作站和线圈电源关系
                DalDEV_WORK_TO_COILPOWER dalDevWorkToCoilpower = new DalDEV_WORK_TO_COILPOWER();

                dalDevWorkToCoilpower.SetDBAccess(GetDBAccess());


                dstemp = dalDevWorkToCoilpower.GetList("F_WORKSTATION_ID='" + workstationId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }

                //工作站和供电柜关系
                DalDEV_WORK_TO_POWER dalDevWorkToPower = new DalDEV_WORK_TO_POWER();

                dalDevWorkToPower.SetDBAccess(GetDBAccess());


                dstemp = dalDevWorkToPower.GetList("F_WORKSTATION_ID='" + workstationId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }

                //工作站和下位机关系
                DalDEV_WORK_TO_SUB dalDevWorkToSub = new DalDEV_WORK_TO_SUB();

                dalDevWorkToSub.SetDBAccess(GetDBAccess());


                dstemp = dalDevWorkToSub.GetList("F_WORKSTATION_ID='" + workstationId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }


                //工作站和温度传感器关系
                DalDEV_WORK_TO_SENSOR dalDevWorkToSensor = new DalDEV_WORK_TO_SENSOR();

                dalDevWorkToSensor.SetDBAccess(GetDBAccess());


                dstemp = dalDevWorkToSensor.GetList("F_WORKSTATION_ID='" + workstationId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }


                return(result);
            }
            catch (Exception ex)
            {
                Log.Error("BllDEV_WORKSTATION_INFO->HasRelation---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllDEV_WORKSTATION_INFO->HasRelation---finally");
            }
        }