Esempio n. 1
0
        public string GetText()
        {
            string archors = "";

            if (Archors != null)
            {
                archors = string.Join(",", Archors.ToArray());
            }
            return(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", Code, X, Y, Z, DateTimeStamp, Power, Number,
                                 Flag, archors));
        }
        private void AddArchorDev(Archor archor1, PhysicalTopology parent)
        {
            DevInfo archor1Dev = new DevInfo()
            {
                Name = archor1.Name, DevID = Guid.NewGuid().ToString(), Parent = parent, TypeCode = 6345
            };

            archor1.Dev = archor1Dev;
            DevInfos.Add(archor1Dev);
            Archors.Add(archor1);
        }
Esempio n. 3
0
 public void AddArchor(string archor)
 {
     if (Archors == null)
     {
         Archors = new List <string>();
     }
     if (string.IsNullOrEmpty(archor))
     {
         return;
     }
     Archors.Add(archor);
 }
 public void ClearTopoTable()
 {
     Log.InfoStart("ClearTopoTable");
     Archors.Clear();
     DevInfos.Clear();
     Maps.Clear();
     PhysicalTopologys.Clear();
     TransformMs.Clear();
     NodeKKSs.Clear();
     Points.Clear();
     Bounds.Clear();
     Log.InfoEnd("ClearTopoTable");
 }
        public bool AddPositions(List <Position> positions)
        {
            bool r = true;

            try
            {
                if (positions == null || positions.Count == 0)
                {
                    return(false);
                }

                //string sql = GetInsertSql(positions);
                //if (!string.IsNullOrEmpty(sql))
                //    DbHistory.Database.ExecuteSqlCommand(sql);

                //List<TagPosition> tagPosList = EditTagPositionList(positions);
                //string sql2 = GetUpdateSql(tagPosList);
                //if (!string.IsNullOrEmpty(sql2))
                //    Db.Database.ExecuteSqlCommand(sql2);

                //todo:获取位置信息参与计算的基站
                foreach (Position position in positions)
                {
                    if (position.Archors != null)
                    {
                        List <Archor> archorList = Archors.FindByCodes(position.Archors);
                        foreach (Archor archor in archorList)
                        {
                            //基站位置和Position位置相等(0.1是为了应对Double类型比较,可能出现的误差)
                            if (Math.Abs(archor.Y - position.Y) < 0.1f)
                            {
                                //找到对应ID,不往后找
                                position.TopoNodeId = archor.Dev.ParentId;
                                break;
                            }
                            //if (!position.TopoNodes.Contains(archor.Dev.ParentId))
                            //    position.TopoNodes.Add(archor.Dev.ParentId);
                        }
                    }
                    else
                    {
                        position.TopoNodeId = null;
                    }
                    //Todo:找不到合适的ID,需要处理一下


                    //foreach (string code in position.Archors)
                    //{
                    //    Archor archor=Archors.FindByCode(code);
                    //    if(!position.TopoNodes.Contains(archor.Dev.ParentId))
                    //        position.TopoNodes.Add(archor.Dev.ParentId);
                    //}
                }
                //1.批量插入历史数据数据
                DbHistory.BulkInsert(positions);//插件Z.EntityFramework.Extensions功能
                //2.获取并修改列表
                List <TagPosition> tagPosList = EditTagPositionList(positions);
                //3.更新列表
                TagPositions.Db.BulkUpdate(tagPosList);//插件Z.EntityFramework.Extensions功能
            }
            catch (Exception ex)
            {
                r = false;
            }
            return(r);
        }