duheng
2024-03-27 dc97e187c607119bbd2945b9a277db8da15f8dc0
WebApi/Controllers/PumpRunController.cs
@@ -1,6 +1,7 @@
using IStation.Dto;
using System;
using System.Collections.Generic;
using System.Security.Policy;
using System.Threading.Tasks;
using System.Web.Http;
using static IStation.Common.PumpHistoryDataFileHelper;
@@ -44,14 +45,14 @@
            return new IStation.Dto.ApiResult<Dto.PumpRunParasDays>(pumpRunParasDay) { Code = ApiResultCode.Success, Message = "Success" };
        }
    /*    /// <summary>
        /// <summary>
        /// 
        /// </summary>
        /// <param name="day"></param>
        /// <returns></returns>
        [Route("GetByHistoryOneDay")]
        [HttpGet]
        public async Task<IStation.Dto.ApiResult> GetByHistoryOneDay(string  day)
        public async Task<IStation.Dto.ApiResult> GetByHistoryOneDay(string day)
        {
            if (day == null)
            {
@@ -61,12 +62,63 @@
            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" };
            var history = Common.PumpRunParasHelper.GetPumpRunParas(d);
            if (history == null)
            {
            }
            history.Electric = Math.Round(history.Electric, 2);
            history.Money = Math.Round(history.Money, 2);
            history.FlowIn = Math.Round(history.FlowIn, 2);
            if (history.Pump1.Count != 0)
            {
                foreach (var item in history.Pump1)
                {
                    item.Electric = Math.Round( item.Electric,2);
                    item.Money = Math.Round(item.Money, 2);
                    item.FlowIn = Math.Round(item.FlowIn, 2);
                }
            }
            if (history.Pump2.Count != 0)
            {
                foreach (var item in history.Pump2)
                {
                    item.Electric = Math.Round(item.Electric, 2);
                    item.Money = Math.Round(item.Money, 2);
                    item.FlowIn = Math.Round(item.FlowIn, 2);
                }
            }
            if (history.Pump3.Count != 0)
            {
                foreach (var item in history.Pump3)
                {
                    item.Electric = Math.Round(item.Electric, 2);
                    item.Money = Math.Round(item.Money, 2);
                    item.FlowIn = Math.Round(item.FlowIn, 2);
                }
            }
            if (history.Pump4.Count != 0)
            {
                foreach (var item in history.Pump4)
                {
                    item.Electric = Math.Round(item.Electric, 2);
                    item.Money = Math.Round(item.Money, 2);
                    item.FlowIn = Math.Round(item.FlowIn, 2);
                }
            }
            if (history.Pump5.Count != 0)
            {
                foreach (var item in history.Pump5)
                {
                    item.Electric = Math.Round(item.Electric, 2);
                    item.Money = Math.Round(item.Money, 2);
                    item.FlowIn = Math.Round(item.FlowIn, 2);
                }
            }
            return new IStation.Dto.ApiResult<Common.PumpRunParasHelper.RunParasData>(history) { Code = ApiResultCode.Success, Message = "Success" };
        }
*/