public BasicResponse <R_CallInfo> AddCall(R_CallAddRequest callRequest)
        {
            var callresponse = new BasicResponse <R_CallInfo>();
            //判断缓存中是否存在
            R_CallInfo oldR_CallInfo = null;
            RCallCacheGetByKeyRequest RCallCacheRequest = new RCallCacheGetByKeyRequest();

            RCallCacheRequest.Id = callRequest.CallInfo.Id;
            oldR_CallInfo        = _RCallCacheService.GetByKeyRCallCache(RCallCacheRequest).Data;
            if (oldR_CallInfo != null)
            {
                //缓存中存在此测点
                callresponse.Code    = 1;
                callresponse.Message = "当前添加的呼叫控制已存在!";
                return(callresponse);
            }
            var _call      = ObjectConverter.Copy <R_CallInfo, R_CallModel>(callRequest.CallInfo);
            var resultcall = _Repository.AddCall(_call);

            //写呼叫历史记录
            AddR_PHJInfo(callRequest.CallInfo);

            //更新缓存
            RCallCacheAddRequest RCallCacheAddRequest = new RCallCacheAddRequest();

            RCallCacheAddRequest.RCallInfo = callRequest.CallInfo;
            _RCallCacheService.AddRCallCache(RCallCacheAddRequest);

            callresponse.Data = ObjectConverter.Copy <R_CallModel, R_CallInfo>(resultcall);
            return(callresponse);
        }
Beispiel #2
0
        /// <summary>
        /// 解除呼叫
        /// </summary>
        /// <param name="Id"></param>
        public void RemoveR_CallInfo(string Id)
        {
            R_CallInfo R_Call = GetAllRCallCache().Find(a => a.Id == Id);

            if (R_Call != null)
            {
                Dictionary <string, Dictionary <string, object> > updateItems = new Dictionary <string, Dictionary <string, object> >();
                Dictionary <string, object> updateItem = new Dictionary <string, object>();

                R_Call.CallType = 2;
                updateItem.Add("CallType", R_Call.CallType);
                R_Call.SendCount = 3;
                updateItem.Add("SendCount", R_Call.SendCount);
                //赋值操作用户,客户端IP地址
                UpdateCreateUser(R_Call);
                updateItem.Add("CreateUserName", R_Call.CreateUserName);
                updateItem.Add("CreateClientIP", R_Call.CreateClientIP);

                updateItems.Add(R_Call.Id, updateItem);

                R_CallUpdateProperitesRequest request = new R_CallUpdateProperitesRequest();
                request.updateItems = updateItems;
                _R_CallService.BachUpdateAlarmInfoProperties(request);
            }
        }
        public BasicResponse DeleteCall(R_CallDeleteRequest callRequest)
        {
            var callresponse = new BasicResponse();
            //判断缓存中是否存在
            R_CallInfo oldR_CallInfo = null;
            RCallCacheGetByKeyRequest RCallCacheRequest = new RCallCacheGetByKeyRequest();

            RCallCacheRequest.Id = callRequest.Id;
            oldR_CallInfo        = _RCallCacheService.GetByKeyRCallCache(RCallCacheRequest).Data;
            if (oldR_CallInfo == null)
            {
                //缓存中存在此测点
                callresponse.Code    = 1;
                callresponse.Message = "当前删除的呼叫控制记录不存在!";
                return(callresponse);
            }

            _Repository.DeleteCall(callRequest.Id);

            //更新缓存
            RCallCacheDeleteRequest RCallCacheDeleteRequest = new RCallCacheDeleteRequest();

            RCallCacheDeleteRequest.RCallInfo = oldR_CallInfo;
            _RCallCacheService.DeleteRCallCache(RCallCacheDeleteRequest);

            return(callresponse);
        }
Beispiel #4
0
        /// <summary>
        /// 添加呼叫
        /// </summary>
        /// <param name="tempCallInfo"></param>
        public void AddR_CallInfo(R_CallInfo tempCallInfo)
        {
            //赋值操作用户,客户端IP地址
            UpdateCreateUser(tempCallInfo);

            R_CallAddRequest callRequest = new R_CallAddRequest();

            callRequest.CallInfo = tempCallInfo;
            _R_CallService.AddCall(callRequest);
        }
Beispiel #5
0
        private void UpdateCreateUser(R_CallInfo tempCallInfo)
        {
            ClientItem clientItem = new ClientItem();

            if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(KeyConst.ClientItemKey))
            {
                clientItem = Basic.Framework.Data.PlatRuntime.Items[KeyConst.ClientItemKey] as ClientItem;
            }
            tempCallInfo.CreateUserName = clientItem.UserName;
            tempCallInfo.CreateClientIP = Basic.Framework.Common.HardwareHelper.GetIPAddress();
        }
        /// <summary>
        /// 将R_Call转换成呼叫历史记录,并写入到R_PHJ表中
        /// </summary>
        /// <param name="tempCallInfo"></param>
        public void AddR_PHJInfo(R_CallInfo tempCallInfo)
        {
            //写呼叫历史记录
            R_PhjInfo r_phj = new R_PhjInfo();

            r_phj.Id       = Basic.Framework.Common.IdHelper.CreateLongId().ToString();
            r_phj.Hjlx     = 1;
            r_phj.Bh       = "0";
            r_phj.Yid      = "0";
            r_phj.PointId  = "0";
            r_phj.CallTime = DateTime.Now;
            r_phj.Tsycs    = 0;
            r_phj.State    = tempCallInfo.Type;
            r_phj.Type     = tempCallInfo.CallType;
            //修改,将呼叫卡号及设备写入明细表中
            //if (tempCallInfo.Type == 0)
            //{
            //    r_phj.Card = tempCallInfo.BhContent;
            //}
            //else
            //{
            //    r_phj.Card = tempCallInfo.PointList;
            //}
            r_phj.Username = tempCallInfo.CreateUserName;
            r_phj.IP       = tempCallInfo.CreateClientIP;
            r_phj.Timer    = DateTime.Now;
            r_phj.Flag     = 0;
            r_phj.SysFlag  = 0;
            r_phj.upflag   = "0";
            r_phj.By2      = tempCallInfo.Type.ToString();
            PhjAddRequest phjRequest = new PhjAddRequest();

            phjRequest.PhjInfo = r_phj;
            _R_PhjService.AddPhjToDB(phjRequest);
            //添加呼叫明细表  20180312
            if (tempCallInfo.BhContent != null && tempCallInfo.BhContent.Length > 0)
            {
                string[] bhList;
                if (tempCallInfo.BhContent.Contains("-"))
                {
                    int sBh = int.Parse(tempCallInfo.BhContent.Split('-')[0]);
                    int eBh = int.Parse(tempCallInfo.BhContent.Split('-')[1]);
                    bhList = new string[12];
                    int bhIndex = sBh;
                    for (int i = 0; i < 12; i++)
                    {
                        bhList[i] = bhIndex.ToString();
                        bhIndex++;
                    }
                }
                bhList = tempCallInfo.BhContent.Split(',');
                foreach (string bh in bhList)
                {
                    List <R_PersoninfInfo> tempPerson = _R_PersoninfService.GetPersoninfCacheByBh(new Sys.Safety.Request.R_Personinf.R_PersoninfGetByBhRequest()
                    {
                        Bh = bh
                    }).Data;
                    if (tempPerson.Count > 0)
                    {
                        //写入呼叫人员历史记录明细表中  20180312
                        _Repository.ExecuteNonQuery("global_R_PhjService_AddPhjPersonDetailToDB",
                                                    r_phj.Timer.ToString("yyyyMM"),
                                                    Basic.Framework.Common.IdHelper.CreateLongId().ToString(),
                                                    r_phj.Id,
                                                    tempPerson[0].Yid);
                    }
                }
            }
            if (tempCallInfo.PointList != null && tempCallInfo.PointList.Length > 0)
            {
                string[] pointList = tempCallInfo.PointList.Split(',');
                foreach (string point in pointList)
                {
                    PointDefineGetByPointRequest PointDefineRequest = new PointDefineGetByPointRequest();
                    PointDefineRequest.Point = point;
                    Jc_DefInfo tempPoint = _PersonPointDefineService.GetPointDefineCacheByPoint(PointDefineRequest).Data;
                    if (tempPoint != null)
                    {
                        //写入呼叫人员历史记录明细表中  20180312
                        _Repository.ExecuteNonQuery("global_R_PhjService_AddPhjPointDetailToDB",
                                                    r_phj.Timer.ToString("yyyyMM"),
                                                    Basic.Framework.Common.IdHelper.CreateLongId().ToString(),
                                                    r_phj.Id,
                                                    tempPoint.PointID);
                    }
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 多系统融合应急联动输出
        /// </summary>
        /// <param name="responsesysEmergencyLinkInfos"></param>
        private void SysEmergencyLinkHandle(JC_LargedataAnalysisConfigInfo analysisConfigInfo, SysEmergencyLinkageInfo responsesysEmergencyLinkInfo)
        {
            try
            {
                //如果模型成立则1.添加控制 2.更新配置缓存 3.写运行记录
                if (analysisConfigInfo.AnalysisResult == 2)
                {
                    //如果不是强制结束则立即执行,如果是强制结束则在大于延迟时间时执行
                    var      isforceend = responsesysEmergencyLinkInfo.IsForceEnd;
                    TimeSpan span       = DateTime.Now - responsesysEmergencyLinkInfo.EndTime;

                    if (!isforceend || (isforceend && span.TotalSeconds > responsesysEmergencyLinkInfo.DelayTime))
                    {
                        #region 1.更新控制缓存

                        string bpointlist  = string.Empty;
                        string rpointlist  = string.Empty;
                        string rpersonlist = string.Empty;

                        //如果应急联动配置存在被控区域,则获取此区域的人员设备和广播设备
                        if (responsesysEmergencyLinkInfo.PassiveAreas != null && responsesysEmergencyLinkInfo.PassiveAreas.Count > 0)
                        {
                            responsesysEmergencyLinkInfo.PassiveAreas.ForEach(area =>
                            {
                                //处理区域广播呼叫
                                var bdefinfos = b_defCacheService.GetPointDefineCacheByAreaID(new PointDefineGetByAreaIDRequest {
                                    AreaId = area.AreaId
                                }).Data;
                                bdefinfos.ForEach(b => { bpointlist += b.PointID + ","; });

                                //处理区域人员呼叫
                                var rdefinfos = rdefCacheService.GetPointDefineCacheByAreaID(new PointDefineGetByAreaIDRequest {
                                    AreaId = area.AreaId
                                }).Data;
                                rdefinfos.ForEach(r => { rpointlist += r.Point + ","; });
                            });
                        }

                        //如果应急联动配置存在被控人员,则获取被控人员列表
                        if (responsesysEmergencyLinkInfo.PassivePersons != null && responsesysEmergencyLinkInfo.PassivePersons.Count > 0)
                        {
                            responsesysEmergencyLinkInfo.PassivePersons.ForEach(p =>
                            {
                                RPersoninfCacheGetByKeyRequest persongetrequest = new RPersoninfCacheGetByKeyRequest();
                                var person = personService.GetPersoninfCache(new R_PersoninfGetRequest()
                                {
                                    Id = p.PersonId
                                }).Data;
                                if (person != null)
                                {
                                    rpersonlist += person.Bh + ",";
                                }
                            });
                        }

                        //如果应急联动配置存在被控设备,则根据类型获取被控测点
                        if (responsesysEmergencyLinkInfo.PassivePoints != null && responsesysEmergencyLinkInfo.PassivePoints.Count > 0)
                        {
                            responsesysEmergencyLinkInfo.PassivePoints.ForEach(p =>
                            {
                                //人员定位
                                if (p.Sysid == (int)SystemEnum.Personnel)
                                {
                                    var rdef = rdefCacheService.GetPointDefineCacheByPointID(new PointDefineGetByPointIDRequest {
                                        PointID = p.PointId
                                    }).Data;
                                    if (rdef != null && !string.IsNullOrEmpty(rdef.PointID))
                                    {
                                        rpointlist += rdef.Point + "|";
                                    }
                                }
                                //广播
                                else if (p.Sysid == (int)SystemEnum.Broadcast)
                                {
                                    var bdef = b_defCacheService.GetPointDefineCacheByPointID(new PointDefineGetByPointIDRequest {
                                        PointID = p.PointId
                                    }).Data;
                                    if (bdef != null && !string.IsNullOrEmpty(bdef.PointID))
                                    {
                                        bpointlist += bdef.PointID + "|";
                                    }
                                }
                            });
                        }

                        //添加广播呼叫
                        if (bpointlist.Length > 0)
                        {
                            BCallInfoGetByMasterIDRequest b_defExistsRequest = new BCallInfoGetByMasterIDRequest();
                            b_defExistsRequest.MasterId = analysisConfigInfo.Id;
                            b_defExistsRequest.CallType = 1;
                            var bcallinfo = bCallService.GetBCallInfoByMasterID(b_defExistsRequest).Data.FirstOrDefault();
                            if (bcallinfo == null)
                            {
                                bpointlist = bpointlist.Substring(0, bpointlist.Length - 1);

                                var bpointarr = bpointlist.Split('|');

                                B_CallInfo bcalladdinfo = new B_CallInfo();
                                string     callid       = IdHelper.CreateLongId().ToString();
                                bcalladdinfo.Id       = callid;
                                bcalladdinfo.CallType = 1;
                                bcalladdinfo.CallTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                                bcalladdinfo.MasterId = analysisConfigInfo.Id;
                                bcalladdinfo.Message  = analysisConfigInfo.TrueDescription;
                                //bcalladdinfo.PointList = bpointlist;

                                List <B_CallpointlistInfo> callpointdetails = new List <B_CallpointlistInfo>();
                                Array.ForEach(bpointarr, point =>
                                {
                                    B_CallpointlistInfo callpointdetail = new B_CallpointlistInfo();
                                    callpointdetail.Id            = IdHelper.CreateLongId().ToString();
                                    callpointdetail.BCallId       = callid;
                                    callpointdetail.CalledPointId = point;

                                    callpointdetails.Add(callpointdetail);
                                });
                                bcalladdinfo.CallPointList = callpointdetails;

                                bCallService.AddCall(new B_CallAddRequest {
                                    CallInfo = bcalladdinfo
                                });
                            }
                        }

                        //添加人员定位设备呼叫
                        if (rpointlist.Length > 0)
                        {
                            RCallInfoGetByMasterIDRequest rcallgetRequest = new RCallInfoGetByMasterIDRequest();
                            rcallgetRequest.MasterId      = analysisConfigInfo.Id;
                            rcallgetRequest.CallType      = 1;
                            rcallgetRequest.IsQueryByType = true;
                            rcallgetRequest.Type          = 1;
                            var rcallinfo = rCallService.GetRCallInfoByMasterID(rcallgetRequest).Data.FirstOrDefault();
                            if (rcallinfo == null)
                            {
                                rpointlist = rpointlist.Substring(0, rpointlist.Length - 1);

                                R_CallInfo rcalladdinfo = new R_CallInfo();
                                rcalladdinfo.Id                = IdHelper.CreateLongId().ToString();
                                rcalladdinfo.Type              = 1;
                                rcalladdinfo.CallType          = 1;
                                rcalladdinfo.CallTime          = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                                rcalladdinfo.MasterId          = analysisConfigInfo.Id;
                                rcalladdinfo.CallPersonDefType = 4;
                                rcalladdinfo.PointList         = rpointlist;

                                rCallService.AddCall(new R_CallAddRequest {
                                    CallInfo = rcalladdinfo
                                });
                            }
                        }

                        //添加人员卡号呼叫
                        if (rpersonlist.Length > 0)
                        {
                            RCallInfoGetByMasterIDRequest rcallgetRequest = new RCallInfoGetByMasterIDRequest();
                            rcallgetRequest.MasterId      = analysisConfigInfo.Id;
                            rcallgetRequest.CallType      = 1;
                            rcallgetRequest.IsQueryByType = true;
                            rcallgetRequest.Type          = 0;
                            var rcallinfo = rCallService.GetRCallInfoByMasterID(rcallgetRequest).Data.FirstOrDefault();
                            if (rcallinfo == null)
                            {
                                rpersonlist = rpersonlist.Substring(0, rpersonlist.Length - 1);

                                R_CallInfo rcalladdinfo = new R_CallInfo();
                                rcalladdinfo.Id                = IdHelper.CreateLongId().ToString();
                                rcalladdinfo.Type              = 0;
                                rcalladdinfo.CallType          = 1;
                                rcalladdinfo.CallTime          = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                                rcalladdinfo.MasterId          = analysisConfigInfo.Id;
                                rcalladdinfo.CallPersonDefType = 2;
                                rcalladdinfo.BhContent         = rpersonlist;

                                rCallService.AddCall(new R_CallAddRequest {
                                    CallInfo = rcalladdinfo
                                });
                            }
                        }
                        #endregion
                    }

                    if (responsesysEmergencyLinkInfo.EmergencyLinkageState != 1)
                    {
                        //2.更新配置缓存
                        responsesysEmergencyLinkInfo.EmergencyLinkageState = 1;
                        sysEmergencyLinkageService.UpdateSysEmergencyLinkage(new SysEmergencyLinkageUpdateRequest {
                            SysEmergencyLinkageInfo = responsesysEmergencyLinkInfo
                        });
                        //3.写运行记录
                        EmergencyLinkHistoryAddRequest ehistoryaddrequest = new EmergencyLinkHistoryAddRequest();
                        EmergencyLinkHistoryInfo       ehistory           = new EmergencyLinkHistoryInfo();
                        ehistory.Id                    = IdHelper.CreateLongId().ToString();
                        ehistory.IsForceEnd            = 0;
                        ehistory.SysEmergencyLinkageId = responsesysEmergencyLinkInfo.Id;
                        ehistory.StartTime             = DateTime.Now;
                        ehistory.EndTime               = new DateTime(1900, 1, 1, 0, 0, 0);
                        ehistoryaddrequest.EmergencyLinkHistoryInfo = ehistory;
                        emergencyLinkHistoryService.AddEmergencyLinkHistory(ehistoryaddrequest);
                    }
                }
                //如果模型不成立则1.解除控制 2.更新配置缓存 3.更新运行记录
                else
                {
                    //解除广播控制
                    BCallInfoGetByMasterIDRequest b_defExistsRequest = new BCallInfoGetByMasterIDRequest();
                    b_defExistsRequest.MasterId = analysisConfigInfo.Id;
                    b_defExistsRequest.CallType = 1;
                    var bcallinfo = bCallService.GetBCallInfoByMasterID(b_defExistsRequest).Data.FirstOrDefault();
                    if (bcallinfo != null && bcallinfo.CallType != 2)
                    {
                        bcallinfo.CallType = 2;
                        bCallService.UpdateCall(new B_CallUpdateRequest {
                            CallInfo = bcallinfo
                        });
                    }

                    //解除人员定位控制
                    RCallInfoGetByMasterIDRequest rcallgetRequest = new RCallInfoGetByMasterIDRequest();
                    rcallgetRequest.MasterId      = analysisConfigInfo.Id;
                    rcallgetRequest.CallType      = 1;
                    rcallgetRequest.IsQueryByType = false;
                    rcallgetRequest.Type          = 0;
                    var rcallinfo = rCallService.GetRCallInfoByMasterID(rcallgetRequest).Data;
                    if (rcallinfo.Count > 0)
                    {
                        rcallinfo.ForEach(o =>
                        {
                            if (o.CallType != 2)
                            {
                                o.CallType = 2;
                                rCallService.UpdateCall(new R_CallUpdateRequest {
                                    CallInfo = o
                                });
                            }
                        });
                    }

                    if (responsesysEmergencyLinkInfo.EmergencyLinkageState != 0)
                    {
                        //2.更新配置缓存
                        responsesysEmergencyLinkInfo.EmergencyLinkageState = 0;
                        sysEmergencyLinkageService.UpdateSysEmergencyLinkage(new SysEmergencyLinkageUpdateRequest {
                            SysEmergencyLinkageInfo = responsesysEmergencyLinkInfo
                        });
                    }

                    //3.更新运行记录
                    var emergencyLinkHistory = emergencyLinkHistoryService.GetEmergencyLinkHistoryByEmergency(new EmergencyLinkHistoryGetByEmergencyRequest {
                        EmergencyId = responsesysEmergencyLinkInfo.Id
                    }).Data;
                    if (emergencyLinkHistory != null && !string.IsNullOrEmpty(emergencyLinkHistory.Id) && emergencyLinkHistory.EndTime.Year == 1900)
                    {
                        emergencyLinkHistory.EndTime = DateTime.Now;
                        emergencyLinkHistoryService.UpdateEmergencyLinkHistory(new EmergencyLinkHistoryUpdateRequest {
                            EmergencyLinkHistoryInfo = emergencyLinkHistory
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Info(" 多系统融合应急联动输出出错!" + ex.Message);
            }
        }
Beispiel #8
0
        /// <summary>新增历史记录和call,更新实时状态
        ///
        /// </summary>
        private static void AddLinkageHisAndCall(SysEmergencyLinkageInfo item,
                                                 List <Jc_BInfo> satisfyJcb, DateTime nowTime, bool ifUpdateRealTimeValue)
        {
            var allPosition = PositionService.GetAllPositionCache().Data;

            //新增联动历史记录
            var emergencyLinkHistoryInfo = new EmergencyLinkHistoryInfo()
            {
                SysEmergencyLinkageId = item.Id,
                StartTime             = nowTime,
                EndTime    = new DateTime(1900, 1, 1),
                IsForceEnd = 0,
                EndPerson  = "0"
            };
            var emergencyLinkageHistoryMasterPointAssList = new List <EmergencyLinkageHistoryMasterPointAssInfo>();

            foreach (var item2 in satisfyJcb)
            {
                var newItem = new EmergencyLinkageHistoryMasterPointAssInfo
                {
                    PointId   = item2.PointID,
                    DataState = item2.Type
                };
                emergencyLinkageHistoryMasterPointAssList.Add(newItem);
            }

            var req = new AddEmergencyLinkHistoryAndAssRequest
            {
                EmergencyLinkHistoryInfo             = emergencyLinkHistoryInfo,
                LinkageHistoryMasterPointAssInfoList = emergencyLinkageHistoryMasterPointAssList
            };

            EmergencyLinkHistoryService.AddEmergencyLinkHistoryAndAss(req);

            //新增人员rcall
            if (item.PassivePersonAssId != "0")
            {
                var req2 = new LongIdRequest()
                {
                    Id = Convert.ToInt64(item.PassivePersonAssId)
                };
                var           res2          = SysEmergencyLinkageService.GetPassivePersonByAssId(req2);
                var           passivePerson = res2.Data;
                StringBuilder sbPersonCard  = new StringBuilder();
                foreach (var item2 in passivePerson)
                {
                    sbPersonCard.Append(item2.Bh + ",");
                }
                if (sbPersonCard.Length > 0)
                {
                    sbPersonCard.Remove(sbPersonCard.Length - 1, 1);
                }

                var newRcall = new R_CallInfo()
                {
                    Id                = IdHelper.CreateLongId().ToString(),
                    MasterId          = item.Id,
                    Type              = 0,
                    CallType          = 1,
                    CallPersonDefType = 2,
                    BhContent         = sbPersonCard.ToString(),
                    CallTime          = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                };
                var req5 = new R_CallAddRequest()
                {
                    CallInfo = newRcall
                };
                RcallService.AddCall(req5);
            }

            //被控区域测点及所选测点获取
            List <IdTextCheck> lisAllAssDef = new List <IdTextCheck>(); //所有关联被控测点

            if (item.PassiveAreaAssId != "0")
            {
                var req6 = new LongIdRequest
                {
                    Id = Convert.ToInt64(item.PassiveAreaAssId)
                };
                var res6             = SysEmergencyLinkageService.GetPassiveAreaInfoByAssId(req6);
                var allPassiveArea   = res6.Data;
                var allPassiveAreaId = new List <string>();
                foreach (var item2 in allPassiveArea)
                {
                    allPassiveAreaId.Add(item2.Areaid);
                }

                var res7            = SysEmergencyLinkageService.GetAllPassivePointInfo();
                var allPassivePoint = res7.Data;

                var passiveAreaPoint =
                    allPassivePoint.Where(a => allPassiveAreaId.Contains(a.AreaId)).ToList();
                lisAllAssDef.AddRange(passiveAreaPoint);
            }
            if (item.PassivePointAssId != "0")
            {
                var req6 = new LongIdRequest()
                {
                    Id = Convert.ToInt64(item.PassivePointAssId)
                };
                var res6 = SysEmergencyLinkageService.GetPassivePointInfoByAssId(req6);
                lisAllAssDef.AddRange(res6.Data);
            }

            //插入测点rcall
            var handlePersonPoint = lisAllAssDef.Where(a => a.SysId == "11").ToList();

            if (handlePersonPoint.Count > 0)
            {
                var handlePersonPointStr = new StringBuilder(); //人员定位系统关联的被控测点字符串
                foreach (var item2 in handlePersonPoint)
                {
                    handlePersonPointStr.Append(item2.Point + ",");
                }
                handlePersonPointStr.Remove(handlePersonPointStr.Length - 1, 1);

                var rcall = new R_CallInfo()
                {
                    Id                = IdHelper.CreateLongId().ToString(),
                    MasterId          = item.Id,
                    Type              = 1,
                    CallType          = 1,
                    CallPersonDefType = 4,
                    PointList         = handlePersonPointStr.ToString(),
                    CallTime          = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                };
                var req8 = new R_CallAddRequest()
                {
                    CallInfo = rcall
                };
                RcallService.AddCall(req8);
            }

            //插入bcall
            var handleBroadcastPoint = lisAllAssDef.Where(a => a.SysId == "12").ToList();

            if (handleBroadcastPoint.Count > 0)
            {
                //var handleBroadcastPointStr = new StringBuilder(); //广播系统关联的被控测点字符串
                //foreach (var item2 in handleBroadcastPoint)
                //{
                //    handleBroadcastPointStr.Append(item2.Point + ",");
                //}
                //handleBroadcastPointStr.Remove(handleBroadcastPointStr.Length - 1, 1);
                var bcallId = IdHelper.CreateLongId().ToString();
                var handleBroadcastPointList = new List <B_CallpointlistInfo>();
                foreach (var item2 in handleBroadcastPoint)
                {
                    var newItem = new B_CallpointlistInfo()
                    {
                        Id            = IdHelper.CreateLongId().ToString(),
                        BCallId       = bcallId,
                        CalledPointId = item2.Id
                    };
                    handleBroadcastPointList.Add(newItem);
                }

                var broadcastDetail = new StringBuilder(); //广播内容
                broadcastDetail.Append(item.Name + ",");
                foreach (var item2 in satisfyJcb)
                {
                    var wzInfo = allPosition.FirstOrDefault(a => a.WzID == item2.Wzid);
                    var wzName = "";
                    if (wzInfo != null)
                    {
                        wzName = wzInfo.Wz;
                    }

                    broadcastDetail.Append(wzName + "," + EnumHelper.GetEnumDescription((DeviceDataState)item2.Type) + ",");
                }
                broadcastDetail.Remove(broadcastDetail.Length - 1, 1);

                var bcall = new B_CallInfo()
                {
                    Id       = bcallId,
                    MasterId = item.Id,
                    CallType = 1,
                    //PointList = handleBroadcastPointStr.ToString(),//注释,调整了表结构,此处需要修改  20171227
                    CallPointList = handleBroadcastPointList,
                    Message       = broadcastDetail.ToString(),
                    CallTime      = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                };
                var req9 = new B_CallAddRequest()
                {
                    CallInfo = bcall
                };
                BcallService.AddCall(req9);
            }

            //更新实时状态
            if (ifUpdateRealTimeValue)
            {
                var req17 = new UpdateRealTimeStateRequest
                {
                    LinkageId = item.Id,
                    State     = "1"
                };
                SysEmergencyLinkageService.UpdateRealTimeState(req17);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                //验证是否已下发呼叫
                if (!Validation())
                {
                    return;
                }
                R_CallInfo tempCallInfo = null;

                if (xtraTabControl1.SelectedTabPageIndex == 0)                            //人员呼叫
                {
                    if (radioGroup1.SelectedIndex == 0 || radioGroup1.SelectedIndex == 1) //呼叫人员
                    {
                        tempCallInfo                   = new R_CallInfo();
                        tempCallInfo.Id                = Basic.Framework.Common.IdHelper.CreateLongId().ToString();
                        tempCallInfo.MasterId          = "0";
                        tempCallInfo.Type              = 0;
                        tempCallInfo.CallType          = radioGroup1.SelectedIndex;
                        tempCallInfo.CallPersonDefType = radioGroup2.SelectedIndex;
                        tempCallInfo.SendCount         = 3;
                        tempCallInfo.CallTime          = DateTime.Now;
                        if (radioGroup2.SelectedIndex == 1)
                        {
                            tempCallInfo.BhContent = textEdit1.Text + "-" + textEdit2.Text;
                        }
                        else if (radioGroup2.SelectedIndex == 2)
                        {
                            string selectPersons = "";
                            foreach (string key in personSelectList.Keys)
                            {
                                selectPersons += key + ",";
                            }
                            if (selectPersons.Contains(","))
                            {
                                selectPersons = selectPersons.Substring(0, selectPersons.Length - 1);
                            }
                            tempCallInfo.BhContent = selectPersons;
                        }
                    }
                }
                else
                {
                    if (radioGroup1.SelectedIndex == 0 || radioGroup1.SelectedIndex == 1)//呼叫设备
                    {
                        tempCallInfo                   = new R_CallInfo();
                        tempCallInfo.Id                = Basic.Framework.Common.IdHelper.CreateLongId().ToString();
                        tempCallInfo.MasterId          = "0";
                        tempCallInfo.Type              = 1;
                        tempCallInfo.CallType          = radioGroup1.SelectedIndex;
                        tempCallInfo.CallPersonDefType = 4;
                        tempCallInfo.SendCount         = 3;
                        tempCallInfo.CallTime          = DateTime.Now;

                        string selectPoints = "";
                        foreach (string key in pointSelectList.Keys)
                        {
                            selectPoints += key + ",";
                        }
                        if (selectPoints.Contains(","))
                        {
                            selectPoints = selectPoints.Substring(0, selectPoints.Length - 1);
                        }
                        tempCallInfo.PointList = selectPoints;
                    }
                }
                //添加到服务器
                if (tempCallInfo != null)
                {
                    Sys.Safety.Client.Control.Model.R_CallModel.R_CallModelInstance.AddR_CallInfo(tempCallInfo);
                }
                XtraMessageBox.Show("添加呼叫成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception ex)
            {
                Basic.Framework.Logging.LogHelper.Error(ex);
            }
        }