private bool IsValidAircraftInfo(RawDataBatch batchData) { if (batchData == null) return false; return IsValidAircraftInfo(batchData.Flight); }
public string InsertRawDataBatch(RawDataBatch batchData) { if (!this.IsValidAircraftInfo(batchData)) return "缺少机型或架次信息。"; if (batchData.Datas == null || batchData.Datas.Length <= 0) return "无数据输入。"; MongoServer mongoServer = this.GetMongoServer(); if (mongoServer != null) { MongoDatabase database = mongoServer.GetDatabase(batchData.Flight.Aircraft.AircraftModel.ModelName); if (database != null) { MongoCollection<Level1FlightRecord> modelCollection = database.GetCollection<Level1FlightRecord>( AircraftMongoDb.COLLECTION_FLIGHT_RECORD_LEVEL1 + batchData.Flight.FlightID); List<Level1FlightRecord> level1Records = new List<Level1FlightRecord>(); foreach (var one in batchData.Datas) { //数据精简 FlightRawData entity = new FlightRawData() { ParameterID = one.ParameterID, Values = one.Values, Second = batchData.Second }; //DEBUG //level1Records.Add(entity.ToLevel1FlightRecord()); } modelCollection.InsertBatch(level1Records); } } return string.Empty; }