public BasicResponse <List <B_CallInfo> > GetFusionCache() { var req = new BCallCacheGetAllRequest(); var listBcall = _BCallCacheService.GetAllBCallCache(req).Data; var req2 = new B_DefCacheGetAllRequest(); var listBDef = _bDefCacheService.GetAll(req2).Data; foreach (var item in listBcall) { foreach (var item2 in item.CallPointList) { var bDef = listBDef.FirstOrDefault(a => a.PointID == item2.CalledPointId); if (bDef != null) { item2.CalledPointId = bDef.Point; } else { item2.CalledPointId = ""; } } } var ret = new BasicResponse <List <B_CallInfo> > { Data = listBcall }; return(ret); }
public BasicResponse PointDefineSaveData() { BasicResponse Result = new BasicResponse(); //修改,根据保存时,置的初始化标记来置初始化标记 B_DefCacheGetAllRequest pointDefineCacheRequest = new B_DefCacheGetAllRequest(); var result = _b_DefCacheService.GetAll(pointDefineCacheRequest); List <Jc_DefInfo> newItems = result.Data.Where(a => a.DefIsInit).ToList(); //保存巡检时,如果设备置了休眠的标记,则将缓存的Bz4更新 20170705 newItems.ForEach(a => { if (a.Dormancyflag) { a.Bz4 |= 0x02; Dictionary <string, object> paramater = new Dictionary <string, object>(); paramater.Add("Bz4", a.Bz4); UpdatePropertiesRequest defineCacheUpdatePropertiesRequest = new UpdatePropertiesRequest(); defineCacheUpdatePropertiesRequest.PointID = a.PointID; defineCacheUpdatePropertiesRequest.UpdateItems = paramater; _b_DefCacheService.UpdateInfo(defineCacheUpdatePropertiesRequest); } }); IEnumerable <IGrouping <short, Jc_DefInfo> > groupFz = newItems.GroupBy(p => p.Fzh); ////驱动预处理 //foreach (IGrouping<short, Jc_DefInfo> info in groupFz) //{ // //调用驱动处理 // Drv_LoadDef(info.ToList<Jc_DefInfo>()); //} ////批量更新到缓存 //result = _rPointDefineCacheService.GetAllRPointDefineCache(pointDefineCacheRequest); //PointDefineCacheBatchUpdateRequest UpdatePointDefineCacheRequest = new PointDefineCacheBatchUpdateRequest(); ////保存巡检后将所有定义初始化判断标记置成false //Dictionary<string, Dictionary<string, object>> updateItemsList = new Dictionary<string, Dictionary<string, object>>(); //Dictionary<string, object> updateItems = new Dictionary<string, object>(); //List<Jc_DefInfo> items = result.Data; //foreach (Jc_DefInfo item in items) //{ // //if (item.DefIsInit)//交叉控制口变化要置kzchangeflag,但不会下发初始化,加上此条件会导致kzchangeflag一直为true // //{ // item.DefIsInit = false; // item.kzchangeflag = false; // item.Dormancyflag = false; // //} // updateItems = new Dictionary<string, object>(); // updateItems.Add("DefIsInit", false); // updateItems.Add("kzchangeflag", false); // updateItems.Add("Dormancyflag", false); // updateItemsList.Add(item.PointID, updateItems); //} //RDefineCacheBatchUpdatePropertiesRequest cacheUpdatePropertiesRequest = new RDefineCacheBatchUpdatePropertiesRequest(); //cacheUpdatePropertiesRequest.PointItems = updateItemsList; //_rPointDefineCacheService.BatchUpdatePointDefineInfo(cacheUpdatePropertiesRequest); //删除缓存中的非活动点 List <Jc_DefInfo> NonActivityList = result.Data.FindAll(a => a.Activity == "0" && a.InfoState == InfoState.Modified); B_DefCacheBatchDeleteRequest DeletePointDefineCacheRequest = new B_DefCacheBatchDeleteRequest(); DeletePointDefineCacheRequest.B_DefInfos = NonActivityList; _b_DefCacheService.BatchDelete(DeletePointDefineCacheRequest); return(Result); }
/// <summary> /// 获取图形对应测点绑定信息 /// </summary> /// <param name="graphicsbaseinfrequest"></param> /// <returns></returns> public BasicResponse <DataTable> GetMapPointsInfo(GetMapPointsInfoRequest graphicsbaseinfrequest) { var response = new BasicResponse <DataTable>(); if (string.IsNullOrWhiteSpace(graphicsbaseinfrequest.GraphId)) { response.Code = -100; response.Message = "参数错误!"; return(response); } try { var graphicsrouteinfData = _Repository.GetMapPointsInfo(graphicsbaseinfrequest.GraphId); if (graphicsrouteinfData.Rows.Count > 0) { var rdefinfos = rdefCacheService.GetAllRPointDefineCache(new Sys.Safety.Request.PersonCache.RPointDefineCacheGetAllRequest()).Data; var bdefinfos = bdefCacheService.GetAll(new B_DefCacheGetAllRequest()).Data; var vdefinfos = vdefCacheService.GetAll(new V_DefCacheGetAllRequest()).Data; foreach (DataRow row in graphicsrouteinfData.Rows) { var rdefinfo = rdefinfos.FirstOrDefault(o => o.Point == row["Point"].ToString()); if (rdefinfo != null) { row["wz"] = rdefinfo.Wz; row["name"] = rdefinfo.DevName; continue; } var bdefinfo = bdefinfos.FirstOrDefault(o => o.Point == row["Point"].ToString()); if (bdefinfo != null) { row["wz"] = bdefinfo.Wz; row["name"] = bdefinfo.DevName; continue; } var vdefino = vdefinfos.FirstOrDefault(o => o.IPAddress == row["Point"].ToString()); if (vdefino != null) { row["wz"] = vdefino.Devname; row["name"] = "视频"; continue; } if (row["SysId"].ToString() == "-1") { row["name"] = "分析模型"; } } } response.Data = graphicsrouteinfData; } catch (Exception ex) { response.Code = -100; response.Message = ex.Message; this.ThrowException("GetMapPointsInfo-获取图形对应测点绑定信息", ex); } return(response); }
public BasicResponse AddEmergencylinkageconfigMasterInfoPassiveInfo( AddEmergencylinkageconfigMasterInfoPassiveInfoRequest request) { var exist = _Repository.AnySysEmergencyLinkageByLambda(a => a.Name == request.SysEmergencyLinkageInfo.Name && a.Activity == 1); if (exist) { return(new BasicResponse() { Code = 1, Message = "应急联动名称已存在!" }); } //同一个大数据分析模型只能配置一个联动 var masterModelId = request.SysEmergencyLinkageInfo.MasterModelId; if (masterModelId != "0") { var req4 = new EmergencyLinkageConfigCacheGetByConditonRequest { Predicate = a => a.MasterModelId == masterModelId }; var res4 = _sysEmergencyLinkageCacheService.GetSysEmergencyLinkageCache(req4); if (res4.Data.Count != 0) { return(new BasicResponse() { Code = 2, Message = "同一个大数据分析模型只能配置一个应急联动!" }); } } request.SysEmergencyLinkageInfo.Id = IdHelper.CreateLongId().ToString(); //主控测点关联id if (request.EmergencyLinkageMasterPointAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.MasterPointAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.MasterPointAssId = "0"; } //主控设备类型关联id if (request.EmergencyLinkageMasterDevTypeAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.MasterDevTypeAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.MasterDevTypeAssId = "0"; } //主控区域关联id if (request.EmergencyLinkageMasterAreaAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.MasterAreaAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.MasterAreaAssId = "0"; } request.SysEmergencyLinkageInfo.MasterTriDataStateAssId = IdHelper.CreateLongId().ToString(); //主控触发数据状态 //被控测点关联id if (request.EmergencyLinkagePassivePointAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.PassivePointAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.PassivePointAssId = "0"; } //被控区域关联id if (request.EmergencyLinkagePassiveAreaAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.PassiveAreaAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.PassiveAreaAssId = "0"; } //被控人员关联id if (request.EmergencyLinkagePassivePersonAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.PassivePersonAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.PassivePersonAssId = "0"; } foreach (var item in request.EmergencyLinkageMasterAreaAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterAreaAssId = request.SysEmergencyLinkageInfo.MasterAreaAssId; } foreach (var item in request.EmergencyLinkageMasterDevTypeAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterDevTypeAssId = request.SysEmergencyLinkageInfo.MasterDevTypeAssId; } foreach (var item in request.EmergencyLinkageMasterPointAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterPointAssId = request.SysEmergencyLinkageInfo.MasterPointAssId; } foreach (var item in request.EmergencyLinkageMasterTriDataStateAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterTriDataStateAssId = request.SysEmergencyLinkageInfo.MasterTriDataStateAssId; } foreach (var item in request.EmergencyLinkagePassiveAreaAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.PassiveAreaAssId = request.SysEmergencyLinkageInfo.PassiveAreaAssId; } foreach (var item in request.EmergencyLinkagePassivePersonAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.PassivePersonAssId = request.SysEmergencyLinkageInfo.PassivePersonAssId; } var req = new V_DefCacheGetAllRequest(); var res = _vDefCacheService.GetAll(req); if (res.Code != 100) { throw new Exception(res.Message); } var allVideoPoint = res.Data; //所有视频系统测点 var res2 = _personPointDefineService.GetAllPointDefineCache(); if (res2.Code != 100) { throw new Exception(res2.Message); } var allPersonPoint = res2.Data; //所有人员定位系统测点 var req3 = new B_DefCacheGetAllRequest(); var res3 = _bDefCacheService.GetAll(req3); if (res3.Code != 100) { throw new Exception(res3.Message); } var allBroadcastPoint = res3.Data; //所有广播系统测点 foreach (var item in request.EmergencyLinkagePassivePointAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.PassivePointAssId = request.SysEmergencyLinkageInfo.PassivePointAssId; var existMonitoringPoint = allVideoPoint.Any(a => a.Id == item.PointId); if (existMonitoringPoint) { item.Sysid = 74; } var existPersonPoint = allPersonPoint.Any(a => a.PointID == item.PointId); if (existPersonPoint) { item.Sysid = 11; } var existBroadcastPoint = allBroadcastPoint.Any(a => a.PointID == item.PointId); if (existBroadcastPoint) { item.Sysid = 12; } } request.SysEmergencyLinkageInfo.EditTime = DateTime.Now; request.SysEmergencyLinkageInfo.Activity = 1; request.SysEmergencyLinkageInfo.DeletePerson = ""; request.SysEmergencyLinkageInfo.DeleteTime = Convert.ToDateTime("1900-01-01"); request.SysEmergencyLinkageInfo.Bz1 = ""; request.SysEmergencyLinkageInfo.Bz2 = ""; request.SysEmergencyLinkageInfo.Bz3 = ""; TransactionsManager.BeginTransaction(() => { var model = ObjectConverter.Copy <SysEmergencyLinkageInfo, SysEmergencyLinkageModel>(request.SysEmergencyLinkageInfo); _Repository.AddSysEmergencyLinkage(model); foreach (var item in request.EmergencyLinkageMasterAreaAssInfo) { var model2 = ObjectConverter .Copy <EmergencyLinkageMasterAreaAssInfo, EmergencyLinkageMasterAreaAssModel>(item); _emergencyLinkageMasterAreaAssRepository.AddEmergencyLinkageMasterAreaAss(model2); } foreach (var item in request.EmergencyLinkageMasterDevTypeAssInfo) { var model3 = ObjectConverter .Copy <EmergencyLinkageMasterDevTypeAssInfo, EmergencyLinkageMasterDevTypeAssModel>(item); _emergencyLinkageMasterDevTypeAssRepository.AddEmergencyLinkageMasterDevTypeAss(model3); } foreach (var item in request.EmergencyLinkageMasterPointAssInfo) { var model4 = ObjectConverter .Copy <EmergencyLinkageMasterPointAssInfo, EmergencyLinkageMasterPointAssModel>(item); _emergencyLinkageMasterPointAssRepository.AddEmergencyLinkageMasterPointAss(model4); } foreach (var item in request.EmergencyLinkageMasterTriDataStateAssInfo) { var model5 = ObjectConverter .Copy <EmergencyLinkageMasterTriDataStateAssInfo, EmergencyLinkageMasterTriDataStateAssModel>( item); _emergencyLinkageMasterTriDataStateAssRepository.AddEmergencyLinkageMasterTriDataStateAss(model5); } foreach (var item in request.EmergencyLinkagePassiveAreaAssInfo) { var model6 = ObjectConverter .Copy <EmergencyLinkagePassiveAreaAssInfo, EmergencyLinkagePassiveAreaAssModel>(item); _emergencyLinkagePassiveAreaAssRepository.AddEmergencyLinkagePassiveAreaAss(model6); } foreach (var item in request.EmergencyLinkagePassivePersonAssInfo) { var model7 = ObjectConverter .Copy <EmergencyLinkagePassivePersonAssInfo, EmergencyLinkagePassivePersonAssModel>(item); _emergencyLinkagePassivePersonAssRepository.AddEmergencyLinkagePassivePersonAss(model7); } foreach (var item in request.EmergencyLinkagePassivePointAssInfo) { var model8 = ObjectConverter .Copy <EmergencyLinkagePassivePointAssInfo, EmergencyLinkagePassivePointAssModel>(item); _emergencyLinkagePassivePointAssRepository.AddEmergencyLinkagePassivePointAss(model8); } }); //更新缓存 request.SysEmergencyLinkageInfo.MasterAreas = request.EmergencyLinkageMasterAreaAssInfo; request.SysEmergencyLinkageInfo.MasterDevTypes = request.EmergencyLinkageMasterDevTypeAssInfo; request.SysEmergencyLinkageInfo.MasterPoint = request.EmergencyLinkageMasterPointAssInfo; request.SysEmergencyLinkageInfo.MasterTriDataStates = request.EmergencyLinkageMasterTriDataStateAssInfo; request.SysEmergencyLinkageInfo.PassiveAreas = request.EmergencyLinkagePassiveAreaAssInfo; request.SysEmergencyLinkageInfo.PassivePersons = request.EmergencyLinkagePassivePersonAssInfo; request.SysEmergencyLinkageInfo.PassivePoints = request.EmergencyLinkagePassivePointAssInfo; request.SysEmergencyLinkageInfo.EmergencyLinkageState = 0; var req2 = new EmergencyLinkageConfigCacheAddRequest { SysEmergencyLinkageInfo = request.SysEmergencyLinkageInfo }; _sysEmergencyLinkageCacheService.AddSysEmergencyLinkageCache(req2); return(new BasicResponse()); }