| | |
| | | IStation.LogHelper.Error(string.Format("ZyPrjRequest Time:{0}-{1} 时间范围错误,不能超过24小时", start_timme, end_timme)); |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "时间范围错误,不能超过24小时" }; |
| | | } |
| | | |
| | | |
| | | IStation.CalcModel.AnaRequest anaRequest = new AnaRequest(); |
| | | anaRequest.CalcOptType = (eCalcOptType)IStation.AnaGlobalParas.Setting.OptSortType; |
| | | anaRequest.StartTime = start_timme; |
| | | anaRequest.EndTime = end_timme; |
| | | anaRequest.WaterLevels长江 = GetTide3Day(_tideSouce, start_timme); |
| | | if(anaRequest.WaterLevels长江 ==null || anaRequest.WaterLevels长江.Count()==0) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "无法获取长江水位数据" }; |
| | | } |
| | | |
| | | #region 取水总量 |
| | | |
| | | double TotalFlowIn = 0; |
| | | if (!string.IsNullOrEmpty(request.TotalFlowIn) && !string.IsNullOrWhiteSpace(request.TotalFlowIn)) |
| | | { |
| | | double TotalFlowIn = 0; |
| | | { |
| | | if (!double.TryParse(request.TotalFlowIn, out TotalFlowIn)) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入数字型取水总量,接受到的输入值是:" + request.TotalFlowIn }; |
| | |
| | | } |
| | | |
| | | #endregion 取水总量 |
| | | |
| | | |
| | | #region 水位要求 |
| | | |
| | | if (!string.IsNullOrEmpty(request.MaxReservoirLevelTime)) |
| | |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入取水总量或水位要求" }; |
| | | } |
| | | double TotalFlowIn = 0; |
| | | if (!double.TryParse(request.TotalFlowIn, out TotalFlowIn)) |
| | | |
| | | if (TotalFlowIn < 1000) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入数字型取水总量,接受到的输入值是:" + request.TotalFlowIn }; |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入取水总量,接受到的输入值是:" + request.TotalFlowIn }; |
| | | } |
| | | } |
| | | |
| | |
| | | anaRequest.StartReservoirLevel) |
| | | }; |
| | | } |
| | | //bool isTemp = false; |
| | | //if (!string.IsNullOrEmpty(request.IsTemporary)) |
| | | //{ |
| | | // isTemp = Convert.ToBoolean(request.IsTemporary); |
| | | //} |
| | | |
| | | IStation.LogHelper.Info("kashi 计算取水总量 "); |
| | | |
| | | var calcHelper = new IStation.CalcPrjHelper(); |
| | | AnaPrj defaultPrj = null; |
| | |
| | | // |
| | | var dto_prj = ToPrjDto(defaultPrj); |
| | | dto_prj.FlowTotalOut = FlowTotalOut需求; |
| | | |
| | | |
| | | #region 推送 |
| | | |
| | | //推送:代码保留 |
| | | //if (!string.IsNullOrEmpty(request.IsSubmit) && Convert.ToBoolean(request.IsSubmit)) |
| | | //{ |
| | | // Task.Run(() => |
| | |
| | | // }); |
| | | //} |
| | | |
| | | #endregion 推送 |
| | | |
| | | // IStation.LogHelper.Info(string.Format(" 产生计算方案:{0}", dto_prj.schemeID)); |
| | | //IStation.LogHelper.Info(string.Format(" 产生计算方案:{0}", dto_prj.schemeID)); |
| | | //IStation.LogHelper.Info(string.Format("Zy Prj 计算成功: \r\n {0} ", JsonHelper.Object2Json(dto_prj))); |
| | | |
| | | |
| | | return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success }; |
| | | } |
| | |
| | | var sumFlow = (from x in requestBase.PerHourFlowOut select x).Sum(); |
| | | dto_prj.FlowTotalOut = sumFlow; |
| | | } |
| | | if(dto_prj.Switchs != null) |
| | | { |
| | | var switch2 = from x in dto_prj.Switchs orderby x.Time select x; |
| | | int index = 1; |
| | | foreach (var sw in switch2) |
| | | { |
| | | sw.Index = index; |
| | | index++; |
| | | } |
| | | dto_prj.Switchs = switch2.ToList(); |
| | | } |
| | | |
| | | return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success }; |
| | | } |
| | |
| | | var sumFlow = (from x in requestBase.PerHourFlowOut select x).Sum(); |
| | | dto_prj.FlowTotalOut = sumFlow; |
| | | } |
| | | |
| | | if (dto_prj.Switchs != null) |
| | | { |
| | | var switch2 = from x in dto_prj.Switchs orderby x.Time select x; |
| | | int index = 1; |
| | | foreach (var sw in switch2) |
| | | { |
| | | sw.Index = index; |
| | | index++; |
| | | } |
| | | dto_prj.Switchs = switch2.ToList(); |
| | | } |
| | | return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success }; |
| | | } |
| | | else |
| | |
| | | var sumFlow = (from x in requestBase.PerHourFlowOut select x).Sum(); |
| | | dto_prj.FlowTotalOut = sumFlow; |
| | | } |
| | | |
| | | if (dto_prj.Switchs != null) |
| | | { |
| | | var switch2 = from x in dto_prj.Switchs orderby x.Time select x; |
| | | int index = 1; |
| | | foreach (var sw in switch2) |
| | | { |
| | | sw.Index = index; |
| | | index++; |
| | | } |
| | | dto_prj.Switchs = switch2.ToList(); |
| | | } |
| | | return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success }; |
| | | } |
| | | else |
| | |
| | | dto_prj.MoneyTotal = Math.Round(defaultPrj.SumMoney, 0); |
| | | |
| | | dto_prj.BlockTimes = new List<ZyDto.SubmitPrjBlockTime>(); |
| | | double maxHeight = 0; |
| | | |
| | | double startHeight = 0; |
| | | |
| | | if (defaultPrj.BlockTimes != null) |
| | |
| | | dto_item.Records = new List<SubmitPrjTime>(); |
| | | foreach (var bt2 in bt.PointTimes) |
| | | { |
| | | maxHeight = Math.Max(maxHeight, bt2.WaterLevelH); |
| | | //if(maxHeight < bt2.WaterLevelH) |
| | | //{ |
| | | // maxHeight = bt2.WaterLevelH; |
| | | // //maxHeight = Math.Max(maxHeight, bt2.WaterLevelH); |
| | | // maxHeightTime = bt2.Time; |
| | | //} |
| | | |
| | | dto_item.Records.Add(new SubmitPrjTime(bt2)); |
| | | } |
| | | } |
| | |
| | | dto_prj.BlockTimes.Add(dto_item); |
| | | } |
| | | } |
| | | dto_prj.MaxWaterLevelH = maxHeight; |
| | | dto_prj.StartWaterLevelH = startHeight; |
| | | if (defaultPrj.MaxWaterLevelH <= 0) |
| | | { |
| | | double maxHeight = 0; |
| | | DateTime maxHeightTime = defaultPrj.StartTime; |
| | | if (defaultPrj.BlockTimes != null) |
| | | { |
| | | foreach (var bt in defaultPrj.BlockTimes) |
| | | { |
| | | if (bt.OpenPumpIndexs == null) |
| | | continue; |
| | | |
| | | if (bt.PointTimes != null) |
| | | { |
| | | foreach (var bt2 in bt.PointTimes) |
| | | { |
| | | if (maxHeight < bt2.WaterLevelH) |
| | | { |
| | | maxHeight = bt2.WaterLevelH; |
| | | //maxHeight = Math.Max(maxHeight, bt2.WaterLevelH); |
| | | maxHeightTime = bt2.Time; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | defaultPrj.MaxWaterLevelH = maxHeight; |
| | | defaultPrj.MaxWaterLevelTime = maxHeightTime; |
| | | } |
| | | |
| | | if(defaultPrj.MaxWaterLevelTime> defaultPrj.StartTime) |
| | | dto_prj.MaxWaterLevelH = string.Format("{0:N2} ({1})", Math.Round( defaultPrj.MaxWaterLevelH,2) , |
| | | defaultPrj.MaxWaterLevelTime.ToString("HH:mm")); |
| | | else |
| | | dto_prj.MaxWaterLevelH = string.Format("{0:N2} ", Math.Round(defaultPrj.MaxWaterLevelH, 2)); |
| | | |
| | | //dto_prj.MaxWaterLevelH = defaultPrj.MaxWaterLevelH; |
| | | //dto_prj.MaxWaterLevelTime = defaultPrj.MaxWaterLevelTime; |
| | | |
| | | dto_prj.StartWaterLevelH = string.Format("{0:N2} ({1})", Math.Round(startHeight, 2), |
| | | defaultPrj.StartTime.ToString("HH:mm")); ; |
| | | dto_prj.Switchs = new List<SubmitPrjSwitchInfo>(); |
| | | if (defaultPrj.PumpSwitchs != null) |
| | | { |