tangxu
2024-05-29 0eed36315d985bf2931edaaea1649d351b5f7681
更改 AnaProject.db
已修改2个文件
32 ■■■■ 文件已修改
WebApi/Controllers/ZyPrjController.cs 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebApi/Data/AnaProject.db 补丁 | 查看 | 原始文档 | blame | 历史
WebApi/Controllers/ZyPrjController.cs
@@ -95,8 +95,7 @@
 
            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;
@@ -109,6 +108,8 @@
            {
                if (string.IsNullOrEmpty(request.MaxReservoirLevel))
                {
                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  请输入取水总量或水位要求",
                start_timme, end_timme ));
                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入取水总量或水位要求" };
                }
            }
@@ -116,11 +117,15 @@
            {
                double TotalFlowIn = 0;
                if(!double.TryParse( request.TotalFlowIn,out TotalFlowIn))
                {
                {
                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  注意取水总量单位是吨,当前参数参数过小",
                start_timme, end_timme));
                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "注意取水总量单位是吨,当前参数参数过小" };
                }
                if (TotalFlowIn < 10000)
                {
                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  注意取水总量单位是吨,当前参数参数过小",
                start_timme, end_timme));
                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "注意取水总量单位是吨,当前参数参数过小" };
                }
@@ -134,11 +139,15 @@
                var water_records = dal.GetByHourRangle( start_timme ,  end_timme );
                if (water_records == null)
                {
                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  水位预测数据为空,请先保持水位预测服务正常运行",
                start_timme, end_timme));
                    return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = "水位预测数据为空,请先保持水位预测服务正常运行" };
                }
                var count = (end_timme - start_timme).TotalHours;
                if (water_records.Count != count)
                {
                {
                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  预测数据获取失败,数据条无法匹配, 检查是否预测服务中断",
                start_timme, end_timme));
                    return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = "预测数据获取失败,数据条无法匹配, 检查是否预测服务中断" };
                }
                
@@ -147,10 +156,13 @@
                {
                    if(r.States == 0)
                    {
                        return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data =
                            string.Format("预测数据异常,无法进行水位计算:{0} {1},{2}",r.DayHour,r.LastPredictValue,r.Description )};
                        var error_info11 = string.Format("预测数据异常,无法进行水位计算:{0} {1},{2}", r.DayHour, r.LastPredictValue, r.Description);
                        IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} , {2}}",
                start_timme, end_timme, error_info11));
                        return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = error_info11
                        };
                    }
                    anaRequest.SpaceFlowOut.Add(r.LastPredictValue);
                    anaRequest.SpaceFlowOut.Add(r.LastPredictValue/10000);
                }
            }
              
@@ -189,8 +201,14 @@
            string error_info = calcHelper.Calc(anaRequest, out defaultPrj);
            if (!string.IsNullOrEmpty(error_info) || defaultPrj == null)
            {
                IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  计算错误, 原因是:{2} ,Request:::  ",
                start_timme, end_timme, error_info)+ JsonHelper.Object2Json( anaRequest));
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "计算错误, 原因是:" + error_info };
            }
            else
            {
                IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  计算成功", start_timme, end_timme ));
            }
            //保存方案
            var ret = Common.HistoryAnaPrjFileHelper.SavePrj(IStation.AnaGlobalParas.Setting, anaRequest, defaultPrj);
WebApi/Data/AnaProject.db
Binary files differ