tangxu
2024-04-29 8b25d4c0c79c26900cea5de537887d658dcfa32e
WebApi/Controllers/ReservoirWaterLevelController.cs
@@ -34,37 +34,37 @@
            return new IStation.Dto.ApiResult<double>(d);
        }
        /// <summary>
        /// 获取今日预测值(24点时)
        /// </summary>
        /// <returns></returns>
        [Route("GetTodayEndPredictiveValue")]
        [HttpGet]
        public async Task<IStation.Dto.ApiResult> GetTodayEndPredictiveValue()
        {
            var now_value = await ZyConnectHelper.GetRealReservoirWaterLevel();
        ///// <summary>
        ///// 获取今日预测值(24点时)
        ///// </summary>
        ///// <returns></returns>
        //[Route("GetTodayEndPredictiveValue")]
        //[HttpGet]
        //public async Task<IStation.Dto.ApiResult> GetTodayEndPredictiveValue()
        //{
        //    var now_value = await ZyConnectHelper.GetRealReservoirWaterLevel();
        //    IStation.CalcModel.AnaRequestBase requestBase
        //    var today_prj = Common.HistoryAnaPrjFileHelper.GetPrj(DateTime.Today);
            var today_prj = Common.HistoryAnaPrjFileHelper.GetPrj(DateTime.Today);
        //    if(today_prj == null || today_prj.BlockTimes == null || today_prj.PointTimes == null)
        //    {
        //        return new IStation.Dto.ApiResult<double>(-100);
        //    }
            if(today_prj == null || today_prj.BlockTimes == null || today_prj.PointTimes == null)
            {
                return new IStation.Dto.ApiResult<double>(-100);
            }
        //    var now = DateTime.Now;
        //    double predictiveValue = now_value;
            var now = DateTime.Now;
            double predictiveValue = now_value;
            foreach(var pt in today_prj.PointTimes)
            {
                if (now > pt.Time)
                {
                    predictiveValue = now_value + today_prj.PointTimes.Last().WaterLevelH - pt.WaterLevelH;
                    return new IStation.Dto.ApiResult<double>(predictiveValue);
                }
            }
        //    foreach(var pt in today_prj.PointTimes)
        //    {
        //        if (now > pt.Time)
        //        {
        //            predictiveValue = now_value + today_prj.PointTimes.Last().WaterLevelH - pt.WaterLevelH;
        //            return new IStation.Dto.ApiResult<double>(predictiveValue);
        //        }
        //    }
            return new IStation.Dto.ApiResult<double>(now_value);
        }
        //    return new IStation.Dto.ApiResult<double>(now_value);
        //}
    }
}