| | |
| | | using IStation.Dto; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading.Tasks; |
| | | using System.Web.Http; |
| | | using static IStation.Common.PumpHistoryDataFileHelper; |
| | | |
| | | namespace IStation.WebApi.Controllers |
| | | { |
| | |
| | | public class PumpRunController : ApiController |
| | | { |
| | | |
| | | Dto.PumpRunParasDays pumpRunParasDay = new Dto.PumpRunParasDays(); |
| | | |
| | | /// <summary> |
| | | /// 获取某一天参数 |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | [Route("GetByOneDay")] |
| | | [HttpGet] |
| | | public async Task<IStation.Dto.ApiResult> GetByOneDay(DateTime startday) |
| | | public async Task<IStation.Dto.ApiResult> GetByOneDay(string startday) |
| | | { |
| | | |
| | | var PumpState = await ZyConnectHelper.GetPumpIsopen(startday,startday); |
| | | DateTime d; |
| | | if (!DateTime.TryParse(startday, out d)) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 格式不正确" }; |
| | | } |
| | | Dto.PumpRunParasDays pumpRunParasDay = new Dto.PumpRunParasDays(); |
| | | var PumpState = await ZyConnectHelper.GetPumpOpenStatusBySingleDay(d,d); |
| | | // var totalWater = await ZyConnectHelper.GetTotalWaterByDayRange_In(startday, startday); |
| | | // pumpRunParasDay.TotalWater = totalWater; |
| | | // var PumpTotalElecty = await ZyConnectHelper.GetPumpTotalElectricity(startday, startday); |
| | |
| | | return new IStation.Dto.ApiResult<Dto.PumpRunParasDays>(pumpRunParasDay) { Code = ApiResultCode.Success, Message = "Success" }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="day"></param> |
| | | /// <returns></returns> |
| | | [Route("GetByHistoryOneDay")] |
| | | [HttpGet] |
| | | public async Task<IStation.Dto.ApiResult> GetByHistoryOneDay(string day) |
| | | { |
| | | if (day == null) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day null" }; |
| | | } |
| | | DateTime d; |
| | | if (!DateTime.TryParse(day, out d)) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 格式不正确" }; |
| | | } |
| | | |
| | | |
| | | var history = Common.PumpHistoryDataFileHelper.GetHistoryData(d); |
| | | return new IStation.Dto.ApiResult<List<RunParasData>>(history) { Code = ApiResultCode.Success, Message = "Success" }; |
| | | } |
| | | |
| | | |
| | | |