/// <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"); } }
/// <summary> /// 判断负载是否和其他设备有关系 /// </summary> /// <param name="loadId">负载id</param> /// <returns></returns> public bool HasRelation(string loadId) { try { Log.Info("BllDEV_LOAD_INFO->HasRelation---START"); bool result = false; //声明一个变量 DataSet dstemp = new DataSet(); ConnectionOpen(); //负载和供电柜输入开关关系 DalDEV_SWITCH_TO_LOAD dalloSwitchToLoad = new DalDEV_SWITCH_TO_LOAD(); dalloSwitchToLoad.SetDBAccess(GetDBAccess()); dstemp = dalloSwitchToLoad.GetList("F_LOAD_ID='" + loadId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //负载和下位机关系 DalDEV_LOAD_TO_SUB dalDevLoadToSub = new DalDEV_LOAD_TO_SUB(); dalDevLoadToSub.SetDBAccess(GetDBAccess()); dstemp = dalDevLoadToSub.GetList("F_LOAD_ID='" + loadId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //负载和线圈电源关系 DalDEV_COILPOWER_TO_LOAD dalDevCoilpowerToLoad = new DalDEV_COILPOWER_TO_LOAD(); dalDevCoilpowerToLoad.SetDBAccess(GetDBAccess()); dstemp = dalDevCoilpowerToLoad.GetList("F_LOAD_ID='" + loadId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } return(result); } catch (Exception ex) { Log.Error("BllDEV_LOAD_INFO->HasRelation---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_LOAD_INFO->HasRelation---finally"); } }