public List <StationData> WaveRefill(MissionInfo missionInfo) { if (missionInfo == null & missionInfo.stationInfoFile == null & missionInfo.forecastFilesHead == null & missionInfo.missionID == 0) { return(null); } //读取站点每日数据 List <StationData> stationDataList = ChartProcess.DailyFileRead(missionInfo); //读取客观数据,若成功则返回更新后的数据,若失败则返回null var stationDataList1 = ChartProcess.NFDataRead(missionInfo, stationDataList); //若更新成功,则保存,并返回新数据,否则返回原数据 if (stationDataList1 != null) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\DailyData\\Wave\\ForecastFiles\\" + DateTime.Today.ToString("yyyyMMdd") + "\\"; string fileName = missionInfo.forecastFilesHead + DateTime.Today.ToString("yyyyMMdd") + ".txt"; if (!ChartProcess.ChartWrite(stationDataList1, baseDirectory + fileName)) { return(null); } return(stationDataList1); } else { return(stationDataList); } }
public bool WaveDataInput(WaveDataInputModel waveDataInputModel) { string stateStr = ""; // 初始化当天的表格,当天没有文件就新建一个 if (!ChartProcess.ChartPreparation(waveDataInputModel.missionInfo)) { return(false); } //读取当天的文件 List <StationData> stationList = ChartProcess.DailyFileRead(waveDataInputModel.missionInfo); if (stationList == null) { return(false); } //寻找相同id的修改预报值 try { stationList.ForEach(s => { s.forecastValue1 = s.stationID == waveDataInputModel.stationID ? waveDataInputModel.forecastValue1 : s.forecastValue1; s.forecastValue2 = s.stationID == waveDataInputModel.stationID ? waveDataInputModel.forecastValue2 : s.forecastValue2; s.forecastValue3 = s.stationID == waveDataInputModel.stationID ? waveDataInputModel.forecastValue3 : s.forecastValue3; s.forecastValue4 = s.stationID == waveDataInputModel.stationID ? waveDataInputModel.forecastValue4 : s.forecastValue4; s.forecastValue5 = s.stationID == waveDataInputModel.stationID ? waveDataInputModel.forecastValue5 : s.forecastValue5; }); string baseDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\DailyData\\Wave\\ForecastFiles\\" + DateTime.Today.ToString("yyyyMMdd") + "\\"; string fileName = waveDataInputModel.missionInfo.forecastFilesHead + DateTime.Today.ToString("yyyyMMdd") + ".txt"; stateStr = fileName; if (!ChartProcess.ChartWrite(stationList, baseDirectory + fileName)) { return(false); } } catch (Exception e) { CommonTools.WriteLog("更新海浪预报信息异常:" + stateStr + "\r\n" + e.Message); return(false); } return(true); }