public int ImportStationAntennas(string path) { var repo = new ExcelQueryFactory { FileName = path }; var excels = (from c in repo.Worksheet <StationAntennaExcel>("Sheet1") select c).ToList(); foreach (var stationAntennaExcel in excels) { StationAntennas.Push(stationAntennaExcel); } return(StationAntennas.Count); }
public async Task <bool> DumpOneStationAntenna() { var stat = StationAntennas.Pop(); if (stat == null) { throw new NullReferenceException("stat is null!"); } await _stationAntennaRepository .UpdateOneInUse <IStationAntennaRepository, StationAntenna, StationAntennaExcel>(stat); var stationCell = _constructionInformation.FirstOrDefault(x => x.CellSerialNum == stat.AntennaNum); if (stationCell != null) { var cell = _cellRepository.FirstOrDefault(x => x.ENodebId == stationCell.ENodebId && x.SectorId == stationCell.SectorId); if (cell != null) { if (cell.Longtitute < 112 && cell.Lattitute < 22 && stat.Longtitute > 112 && stat.Lattitute > 22) { cell.Longtitute = stat.Longtitute; cell.Lattitute = stat.Lattitute; cell.ETilt = stat.ETilt; cell.MTilt = stat.MTilt; cell.Height = stat.Height; cell.Azimuth = stat.Azimuth; var antennaGainArray = string.IsNullOrEmpty(stat.AntennaGain) ? new string[] { } : stat.AntennaGain.GetSplittedFields('/'); cell.AntennaGain = cell.BandClass == 5 ? (antennaGainArray.Length > 1 ? antennaGainArray[1].ConvertToDouble(17.5) : (antennaGainArray.Length > 0 ? antennaGainArray[0].ConvertToDouble(17.5) : 17.5)) : (antennaGainArray.Length > 0 ? antennaGainArray[0].ConvertToDouble(15) : 15); _cellRepository.SaveChanges(); } } var rru = _rruRepository.FirstOrDefault(x => x.ENodebId == stationCell.ENodebId && x.LocalSectorId == stationCell.LocalCellId); if (rru == null) { rru = new LteRru { ENodebId = stationCell.ENodebId, LocalSectorId = stationCell.LocalCellId, AntennaModel = stat.AntennaModel, AntennaFactory = stat.AntennaFactoryDescription.GetEnumType <AntennaFactory>(), AntennaInfo = stat.AntennaPorts + "端口天线;" + (stat.CommonAntennaWithCdma == "是" ? "与C网共用天线" : "独立天线"), CanBeTilt = stat.ElectricAdjustable == "是", RruName = stat.AntennaAddress }; _rruRepository.Insert(rru); } else { rru.AntennaModel = stat.AntennaModel; rru.AntennaFactory = stat.AntennaFactoryDescription.GetEnumType <AntennaFactory>(); rru.AntennaInfo = stat.AntennaPorts + "端口天线;" + (stat.CommonAntennaWithCdma == "是" ? "与C网共用天线" : "独立天线"); rru.CanBeTilt = stat.ElectricAdjustable == "是"; rru.RruName = stat.AntennaAddress; } _rruRepository.SaveChanges(); } return(true); }