duheng
2024-05-29 d1dabed0594e07684112a4454d82f90e636fbb84
Merge branch 'master' of http://47.103.154.90:83/r/IStation/shys/ChEqCalc.V1.3
已修改5个文件
63 ■■■■ 文件已修改
DAL/IStation.DAL.Paras/历史调度方案/HistoryAnaPrjFileHelper.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/IStation.DAL.Project/DAL/AnaProject.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/IStation.DAL.Project/Entity/AnaProjectEntity.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebApi/Controllers/ZyPrjController.cs 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebApi/Data/AnaProject.db 补丁 | 查看 | 原始文档 | blame | 历史
DAL/IStation.DAL.Paras/ÀúÊ·µ÷¶È·½°¸/HistoryAnaPrjFileHelper.cs
@@ -21,7 +21,7 @@
            return SavePrj(settting, new IStation.CalcModel.AnaRequestBase(request), prj);
            return SavePrjCore(settting, new IStation.CalcModel.AnaRequestBase(request), prj);
        }
        //保存 
@@ -34,8 +34,12 @@
            var dal = new IStation.DAL.AnaProject();
            dal.Insert(prj, requestBase);
            //
            var root_folder = System.IO.Path.Combine(IStation.DataFolderHelper.GetRootPath(), "History");
            return SavePrjCore(settting, requestBase, prj);
        }
        private static bool SavePrjCore(CalcModel.AnaSetting settting, IStation.CalcModel.AnaRequestBase requestBase, IStation.CalcModel.AnaPrj prj)
         {
                var root_folder = System.IO.Path.Combine(IStation.DataFolderHelper.GetRootPath(), "History");
            if (!System.IO.Directory.Exists(root_folder))
            {
                System.IO.Directory.CreateDirectory(root_folder);
DAL/IStation.DAL.Project/DAL/AnaProject.cs
@@ -66,7 +66,14 @@
            {
                entity.TotalFlowIn = ana_request.TotalFlowIn.ToString();
            }
            if (ana_request.SpaceFlowOut != null)
            {
                entity.TotalFlowOut = string.Join(",", ana_request.SpaceFlowOut) ;
            }
            if(ana_request.MaxLimitWaterBoxLevel != null)
            {
                entity.LevelRequest = string.Format("{0}@{1}", ana_request.MaxLimitWaterBoxLevel, ana_request.MaxLimitWaterBoxTime);
            }
            entity.CalcOptType = (int)ana_request.CalcOptType;
            SnowFlakeSingle.WorkId = 1;
@@ -91,7 +98,14 @@
            {
                entity.TotalFlowIn =  ana_request.TotalFlowIn.ToString();
            }
            if (ana_request.SpaceFlowOut != null)
            {
                entity.TotalFlowOut = string.Join(",", ana_request.SpaceFlowOut);
            }
            if (ana_request.MaxLimitWaterBoxLevel != null)
            {
                entity.LevelRequest = string.Format("{0}@{1}", ana_request.MaxLimitWaterBoxLevel, ana_request.MaxLimitWaterBoxTime);
            }
            entity.CalcOptType = (int)ana_request.CalcOptType;
            SnowFlakeSingle.WorkId = 1;
DAL/IStation.DAL.Project/Entity/AnaProjectEntity.cs
@@ -35,8 +35,9 @@
        [DataMember]
        public int CalcOptType { get; set; }
        [DataMember]
        public string LevelRequest { get; set; }
        
    }
 
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