/// <summary> /// 自动生成扇区的id,和iid ,根据20160831郭琴的邮件, /// 扇区的id为基站中所有扇区根据索引号来编号,起始编号为1 /// 扇区iid的编号为基站iid-扇区id /// </summary> private static void BuildCelliid(AirComLTENodeBaseInfo BaseInfo, List <AircomCell> Sectors) { int cellid = 1; foreach (var cell in Sectors) { cell.CellID = cellid; cell.Celliid = string.Format("{0}-{1}", BaseInfo.Stationiid, cellid); foreach (var antenner in cell.Antenners) { antenner.Celliid = cell.Celliid; } cellid++; } }
/// <summary> /// 根据界面参数生成基站基础信息 /// </summary> /// <returns></returns> public AirComLTENodeBaseInfo BuildBasicInfo() { try { AirComLTENodeBaseInfo Info = new AirComLTENodeBaseInfo(); Info.Stationiid = txtStationID.Text.Trim(); Info.StationAlias = txtAlias.Text.Trim(); Info.Lng = double.Parse(txtLng.Text.Trim()); Info.Lat = double.Parse(txtLat.Text.Trim()); Info.CoverType = (EnumCoverType)cmbCoverType.SelectedIndex; Info.StationType = (EnumStationType)cmbStationType.SelectedIndex; Info.SaveType = (EnumSaveType)cmbSaveType.SelectedIndex; return(Info); } catch (Exception ex) { JLog.Instance.Error(ex.Message, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().Module.Name); return(null); } }
/// <summary> /// 生成XML文件 /// </summary> /// <param name="BaseInfo"></param> /// <param name="_LteNode"></param> private static bool CreateXMLFiles(AirComLTENodeBaseInfo BaseInfo, LTENodeType _LteNode, string Savedir, out XmlFilePackageInfo XmlFiles) { //try //{ List <RootEntityType> Nodes = new List <RootEntityType>(); List <LTENodeType> nodesList = new List <LTENodeType>(); Nodes.Add(_LteNode); nodesList.Add(_LteNode); Savedir = GlobalInfo.Instance.ConfigParam.XmlFileSaveDir.Trim(); if (!Directory.Exists(Savedir)) { DirectoryInfo dirInfo = Directory.CreateDirectory(Savedir); } var Prjobj = GlobalInfo.Instance.ConfigParam.ProjectNames.FirstOrDefault(Fo => Fo.CityEName.Equals(BaseInfo.CityName)); if (Prjobj == null) { JLog.Instance.AppInfo("没有找到相应的工程配置"); } XmlFiles = new XmlFilePackageInfo(); JLog.Instance.AppInfo("开始生成导入基站XML文件"); BuildLteNodeXML(Nodes, Savedir, out XmlFiles.InputLTENodeFileFullName); JLog.Instance.AppInfo("开始生成删除基站XML文件"); BuilLteNodeDeleteXML(Prjobj.ProjectName, nodesList, Savedir, out XmlFiles.DeleteLTENodeFileFullName); JLog.Instance.AppInfo("开始生成导入位置信息XML文件"); BuildLocationXML(BaseInfo, Savedir, out XmlFiles.InputLocationFileFullName); JLog.Instance.AppInfo("开始生成删除位置信息XML文件"); BuildLocationDeleteXML(BaseInfo, Savedir, out XmlFiles.DeleteLocationFileFullName); return(true); //} //catch (Exception ex) //{ // JLog.Instance.Error(ex.Message, MethodBase.GetCurrentMethod().Name, // MethodBase.GetCurrentMethod().Module.Name); // XmlFiles = new XmlFilePackageInfo(); // return false; //} }
/// <summary> /// 生成XML文件 /// </summary> /// <param name="BaseInfo">站点基本信息</param> /// <param name="Sectors">扇区信息,每个扇区的天线信息</param> /// <param name="AllAntennas">所有天线的信息</param> /// <param name="Savedir">保存目录</param> /// <returns></returns> public static bool BuilLTEXMLFilesInterface(AirComLTENodeBaseInfo BaseInfo, List <AircomCell> Sectors, string Savedir, out XmlFilePackageInfo XmlFiles) { try { LTENodeType _LteNode = new LTENodeType(); List <AirComAntennaType> AllAntennas = new List <AirComAntennaType>(); List <AirComAntennaType> SubAntennas = new List <AirComAntennaType>(); BuildCelliid(BaseInfo, Sectors); foreach (var Sector in Sectors) { //Sectors.TryGetValue(key, out SubAntennas); AllAntennas.AddRange(Sector.Antenners as List <AirComAntennaType>); } BuildStationInfo(BaseInfo, ref _LteNode); BuildCarrierInfo(Sectors, ref _LteNode); BuildAntennaInfo(AllAntennas, ref _LteNode); BuildCellInfo(Sectors, ref _LteNode); #region 生成XML //XmlFiles = new XmlFilePackageInfo(); return(CreateXMLFiles(BaseInfo, _LteNode, Savedir, out XmlFiles)); #endregion } catch (Exception ex) { JLog.Instance.Error(ex.Message, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().Module.Name); XmlFiles = null; return(false); } }
/// <summary> /// 注入基础信息至RefLteNode /// </summary> /// <param name="BaseInfo">AirComLTENodeBaseInfo类型的用户输入的基站信息</param> /// <param name="RefLteNode">新生成的,EDS中的基站信息--LTENodeType类型</param> private static void BuildStationInfo(AirComLTENodeBaseInfo BaseInfo, ref LTENodeType RefLteNode) { #region 基本信息 RefLteNode.iid = BaseInfo.Stationiid; RefLteNode.Location = new IDType() { iid = BaseInfo.Stationiid//唯一识别,同_LteNode.iid一致 //基站ID }; //RefLteNode.Comments = GlobalInfo.Instance.ConfigParam.ProjectNames[0].CityName; //地市--可有可无---毕工确认 @20150808 ---(wjj:根据登录用户获取地市及工程名称) RefLteNode.Comments = BaseInfo.CityName; //地市--可有可无---毕工确认 @20150808 ---(wjj:根据登录用户获取地市及工程名称)--由浪潮提供@2016-04-03。 RefLteNode.PLMN = new IDType() { //iid = GlobalInfo.Instance.ConfigParam.ProjectNames[0].ProjectName//工程同名---这个是必须的同---毕工确认 @20150808// //iid = "plan"//固定值plan---郭琴确认 @20151127// iid = "PLMN0"//固定值plan---郭琴确认 @20160622// //工程名是定死的,用户可选择地市信息,系统根据地市信息获取工程名(可配置) }; RefLteNode.Name2 = BaseInfo.PlanPrjID.ToString();//填基站的规划期数;规划期数由用户在界面上输入。 //RefLteNode.NodeID = 0;//毕工确认 @20150808 //wjj20150930 可忽略的值不用输入,序列化时会忽略 #endregion }
/// <summary> /// 生成位置信息删除XML数据 /// </summary> /// <param name="BaseInfo"></param> public static bool BuildLocationDeleteXML(AirComLTENodeBaseInfo BaseInfo, string SaveDir, out string XmlFileFullName) { try { LocationObjectv70Type location = new LocationObjectv70Type(); var Prjobj = GlobalInfo.Instance.ConfigParam.ProjectNames.FirstOrDefault(Fo => Fo.CityEName.Equals(BaseInfo.CityName)); if (Prjobj == null) { JLog.Instance.AppInfo("没有找到相应的工程配置"); XmlFileFullName = string.Empty; return(false); } location.bvid = Prjobj.ProjectName; location.iid = BaseInfo.Stationiid; List <RootEntityType> Locations = new List <RootEntityType>(); Locations.Add(location); #region 序列化示例 XmlSerializerNamespaces nsMgr = new XmlSerializerNamespaces(); #region 指定命名空间 nsMgr.Add("umts70", "http://www.aircominternational.com/Schemas/UMTS/2010/08"); nsMgr.Add("gsm", "http://www.aircominternational.com/Schemas/GSM/2009/09"); nsMgr.Add("eqp", "http://www.aircominternational.com/Schemas/Equipment/2009/09"); nsMgr.Add("umts", "http://www.aircominternational.com/Schemas/UMTS/2010/07"); nsMgr.Add("tra70", "http://www.aircominternational.com/Schemas/Connect/2010/08"); nsMgr.Add("co", "http://www.aircominternational.com/Schemas/Common/2009/07"); nsMgr.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance"); nsMgr.Add("co70", "http://www.aircominternational.com/Schemas/Common/2010/08"); nsMgr.Add("gsm70", "http://www.aircominternational.com/Schemas/GSM/2010/08"); nsMgr.Add("util", "http://www.aircominternational.com/contract/Util/2009/10"); nsMgr.Add("config", "http://www.aircominternational.com/Schemas/Configuration/2010/08"); nsMgr.Add("tra", "http://www.aircominternational.com/Schemas/Connect/2009/09"); nsMgr.Add("ct", "http://www.aircominternational.com/Schemas/CommonTypes/2009/05"); nsMgr.Add("lte", "http://www.aircominternational.com/Schemas/LTE/2010/08"); nsMgr.Add("eqp70", "http://www.aircominternational.com/Schemas/Equipment/2010/08"); nsMgr.Add("umts2", "http://www.aircominternational.com/Schemas/UMTS/2009/05"); #endregion Type[] knowTypes = new[] { typeof(LocationObjectv70Type), //typeof(LTENodeCarrierType), //typeof(LTEAntennaType), typeof(LocationTypeType) //typeof(PredictionModelReferenceType) }; XmlWriterSettings settings = new XmlWriterSettings() { Indent = true, IndentChars = ("\t\t"), NamespaceHandling = NamespaceHandling.OmitDuplicates, NewLineHandling = NewLineHandling.Entitize //NewLineOnAttributes = true }; XmlSerializer sr = new XmlSerializer(typeof(List <RootEntityType>), knowTypes); XmlFileFullName = string.Format("{1}\\LTELocationTypes_deleted_tpl_{0}.xml", DateTime.Now.ToString("yyyymmddHHMMss"), SaveDir); using (XmlWriter wr = XmlWriter.Create(XmlFileFullName, settings)) { sr.Serialize(wr, Locations, nsMgr); } return(true); #endregion } catch (Exception ex) { JLog.Instance.Error(ex.Message, MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().Module.Name); XmlFileFullName = string.Empty; return(false); } }