tangxu
2024-05-29 14725e33b8edeaa2235e01792c0440d79a0d9b83
WebApi/Controllers/ZyPrjController.cs
@@ -29,8 +29,8 @@
        public string StartTime { get; set; }
        public string EndTime { get; set; }
        public int? StartOpenCount { get; set; } = -1;
        public double? TotalFlowIn { get; set; }//取水总量 (单位 吨)
        public string TotalFlowIn { get; set; }//取水总量 (单位 吨)
        public string StartReservoirLevel { get; set; }//开始水库水位(可空):单位m
        public string MaxReservoirLevel { get; set; }//最高水库水位限制(可空):单位m
        public string MaxReservoirLevelTime { get; set; }//最高水库水位限制时间(可空) 时间格式
@@ -93,23 +93,37 @@
            }
            if (request.TotalFlowIn == null)
            {
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "取水总量错误" };
            }
            if (request.TotalFlowIn < 10000)
                if (string.IsNullOrEmpty(request.MaxReservoirLevel  ))
            {
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "注意取水总量单位是吨,当前参数参数过小" };
                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入取水总量或水位要求" };
                }
            }
            IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,StartOpenCount:{2}, TotalFlowIn:{3}",
                start_timme, end_timme, request.StartOpenCount, request.TotalFlowIn));
            IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,StartOpenCount:{2} ",
                start_timme, end_timme, request.StartOpenCount ));
            IStation.CalcModel.AnaRequest anaRequest = new AnaRequest();
            anaRequest.CalcOptType = (eCalcOptType)IStation.AnaGlobalParas.Setting.OptSortType;
            anaRequest.StartTime = start_timme;
            anaRequest.EndTime = end_timme;
            anaRequest.WaterLevels长江 = GetTide3Day(start_timme);
            if(!string.IsNullOrEmpty(request.TotalFlowIn))
            {
                double TotalFlowIn = 0;
                if(!double.TryParse( request.TotalFlowIn,out TotalFlowIn))
                {
                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "注意取水总量单位是吨,当前参数参数过小" };
                }
                if (TotalFlowIn < 10000)
                {
                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "注意取水总量单位是吨,当前参数参数过小" };
                }
            anaRequest.TotalFlow取水总量 = request.TotalFlowIn;
                anaRequest.TotalFlowIn = TotalFlowIn;
            }
            if (request.StartOpenCount == null)
            {
@@ -342,7 +356,7 @@
                return new IStation.Dto.ApiResult<bool>(false);
            }
            var model_setting = IStation.AnaGlobalParas.Setting;
            IStation.LogHelper.Info("ZyPrj SaveSetting");
            if (dto.MinOpenTimeMinute < 5)
            {
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "最少开泵时间 设置过少" };
@@ -379,6 +393,8 @@
                model_setting.SwitchPumpIgnoreTimes = new List<CalcModel.AnaSetting.TimeRange>();
                foreach (var m in dto.SwitchPumpIgnoreTimes)
                {
                    if (m.StartHour == 0 && m.EndHour == 0 && m.StartMinute == 0 && m.EndMinute == 0)
                        continue;
                    if (m.StartHour < 0 || m.StartHour > 24)
                    {
                        return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "不许切泵时间 时间范围设置不合理" };