| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using System.Web.Http; |
| | | |
| | | namespace IStation.WebApi.Controllers |
| | | { |
| | |
| | | public class AnaPrjController : ApiController |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | /// <param name="day"></param> |
| | | /// <returns></returns> |
| | | [Route("Debug")] |
| | | [HttpGet] |
| | | public IStation.Dto.ApiResult Debug(string info) |
| | | { |
| | | IStation.LogHelper.Info("debug:"+ info); |
| | | { |
| | | IStation.LogHelper.Info("debug:" + info); |
| | | |
| | | //IStation.CalcModel.AnaPrj entity = new IStation.CalcModel.AnaPrj(); |
| | | //entity.ID = "123"; |
| | |
| | | //var dal = new IStation.DAL.AnaProject(); |
| | | //dal.Insert(entity, ana_request); |
| | | |
| | | |
| | | var dal = new IStation.DAL.AnaProject(); |
| | | var aa = dal.GetLastRecord(); |
| | | return new IStation.Dto.ApiResult<string >("ok"); |
| | | return new IStation.Dto.ApiResult<string>("ok"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | /// <param name="day"></param> |
| | | /// <returns></returns> |
| | |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 格式不正确" }; |
| | | } |
| | | IStation.CalcModel.AnaRequestBase requestBase = null; |
| | | var prj = Common.HistoryAnaPrjFileHelper.GetByStartDay(d,out requestBase); |
| | | var prj = Common.HistoryAnaPrjFileHelper.GetByStartDay(d, out requestBase); |
| | | return new IStation.Dto.ApiResult<IStation.CalcModel.AnaPrj>(prj); |
| | | } |
| | | |
| | |
| | | anaRequest.WaterLevels长江 = ZyPrjController.GetTide3Day(Model.eTideSouce.Book, start_timme); |
| | | |
| | | #region 取水总量 |
| | | |
| | | if (!string.IsNullOrEmpty(request.TotalFlowIn)) |
| | | { |
| | | double TotalFlowIn = 0; |
| | |
| | | |
| | | anaRequest.TotalFlowIn = TotalFlowIn; |
| | | } |
| | | #endregion |
| | | |
| | | #region 水位要求 |
| | | #endregion 取水总量 |
| | | |
| | | #region 水位要求 |
| | | |
| | | if (!string.IsNullOrEmpty(request.MaxReservoirLevelTime)) |
| | | { |
| | | anaRequest.MaxReservoirLevelTime = request.MaxReservoirLevelTime; |
| | |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "请输入取水总量或水位要求" }; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion 水位要求 |
| | | |
| | | #region 供水量 |
| | | |
| | | if (string.IsNullOrEmpty(request.TotalFlowOut)) |
| | | {//用预测值 |
| | | #region 用预测值 |
| | | |
| | | anaRequest.PerHourFlowOut = new List<double>(); |
| | | IStation.DAL.WaterPredictRecord dal = new DAL.WaterPredictRecord(); |
| | | var water_records = dal.GetByHourRangle(start_timme, end_timme); |
| | |
| | | Data = error_info11 |
| | | }; |
| | | } |
| | | anaRequest.PerHourFlowOut.Add(r.LastPredictValue );//计算中用吨 |
| | | anaRequest.PerHourFlowOut.Add(r.LastPredictValue);//计算中用吨 |
| | | } |
| | | #endregion |
| | | |
| | | #endregion 用预测值 |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | anaRequest.PerHourFlowOut = list; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion 供水量 |
| | | |
| | | //开始时的开机状态 |
| | | if (request.StartOpenPumpIndexArray == null) |
| | |
| | | } |
| | | anaRequest.IsKnownStartOpenPump = true; |
| | | anaRequest.StartOpenPumpIndexArray = request.StartOpenPumpIndexArray; |
| | | |
| | | |
| | | //陈行水库水位 |
| | | if (string.IsNullOrEmpty(request.StartReservoirLevel)) |
| | |
| | | // isTemp = Convert.ToBoolean(request.IsTemporary); |
| | | //} |
| | | |
| | | |
| | | var calcHelper = new IStation.CalcPrjHelper(); |
| | | AnaPrj defaultPrj = null; |
| | | string error_info = calcHelper.Calc(anaRequest, out defaultPrj); |
| | |
| | | //{ |
| | | // var ret = Common.HistoryAnaPrjFileHelper.SavePrj(IStation.AnaGlobalParas.Setting, anaRequest, defaultPrj); |
| | | //} |
| | | |
| | | |
| | | |
| | | |
| | | #region 推送 |
| | | |
| | |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 格式不正确" }; |
| | | } |
| | | |
| | | |
| | | |
| | | IStation.CalcModel.AnaRequestBase requestBase; |
| | | var prj = Common.HistoryAnaPrjFileHelper.GetByEndTime大于(last_end_time, out requestBase); |
| | |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = string.Format("未找到{0}结束的分析项目", AnaStartTime) }; |
| | | } |
| | | |
| | | DateTime calcTime = DateTime.Now;//new DateTime(2024, 6, 11, 17, 10, 10);// |
| | | DateTime calcTime = DateTime.Now;//new DateTime(2024, 6, 11, 17, 10, 10);// |
| | | |
| | | IStation.CalcModel.ZyStartInfo zyStartInfo = new IStation.CalcModel.ZyStartInfo(); |
| | | if (prj.EndTimeOpenPumpStatus != null && prj.EndTimeOpenPumpStatus.Count > 0) |
| | | { |
| | | zyStartInfo.OpenPumpStatus = string.Join("," , prj.EndTimeOpenPumpStatus); |
| | | zyStartInfo.OpenPumpStatus = string.Join(",", prj.EndTimeOpenPumpStatus); |
| | | } |
| | | |
| | | |
| | | var near_pt = prj.NearPointTime(calcTime); |
| | | if (near_pt == null) |
| | |
| | | var lz = prj.BlockTimes.Last().PointTimes.Last().WaterLevelH; |
| | | double start_yuce = lz + now_level - new_yuce; |
| | | |
| | | |
| | | IStation.LogHelper.Info(string.Format("GetAnaStartPara {0},{1},{2},{3} ", lz, now_level, new_yuce, start_yuce)); |
| | | |
| | | zyStartInfo.ReservoirWaterLevel = start_yuce; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | /// <param name="day"></param> |
| | | /// <returns></returns> |
| | |
| | | var list = HistoryAnaPrjFileHelper.GetExistStatus(year, month); |
| | | if (list == null) |
| | | { |
| | | list = new List<string >(); |
| | | list = new List<string>(); |
| | | } |
| | | |
| | | |
| | | return new IStation.Dto.ApiResult<List<string>>(list); |
| | | } |
| | | |
| | | |
| | | ///// <summary> |
| | | ///// |
| | | ///// |
| | | ///// </summary> |
| | | ///// <param name="day"></param> |
| | | ///// <returns></returns> |
| | |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// |
| | | ///// |
| | | ///// </summary> |
| | | ///// <param name="day"></param> |
| | | ///// <returns></returns> |
| | |
| | | // var status = HistoryAnaPrjFileHelper.GetLastTime_OpenPumpStatus(day); |
| | | // if(status == null) |
| | | // return new IStation.Dto.ApiResult<string >(""); |
| | | // else |
| | | // else |
| | | // return new IStation.Dto.ApiResult<string >(string.Join(",",status)); |
| | | //} |
| | | |
| | | public class SavePrjRequest |
| | | { |
| | | { |
| | | public IStation.CalcModel.AnaSetting settting { get; set; } |
| | | public IStation.CalcModel.AnaRequestBase requestBase { get; set; } |
| | | public IStation.CalcModel.AnaPrj prj { get; set; } |
| | | public bool isSubmit { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <returns></returns> |
| | |
| | | [HttpPost] |
| | | public async Task<IStation.Dto.ApiResult> SavePrj([FromBody] SavePrjRequest request) |
| | | { |
| | | if (request == null ) |
| | | if (request == null) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day null" }; |
| | | } |
| | |
| | | //var dal = new IStation.DAL.AnaProject(); |
| | | //dal.Insert(request.prj, request.requestBase); |
| | | |
| | | |
| | | if (request.isSubmit) |
| | | { |
| | | string error = await ZyProjectHelper.SubmitPrj(request.prj);//, (id) => { IStation.LogHelper.Info("SavePrj success id=" + id); }, (info) => { IStation.LogHelper.Info("SavePrj failse info:" + info); });//.Result; |
| | | |
| | | if(!string.IsNullOrEmpty(error)) |
| | | if (!string.IsNullOrEmpty(error)) |
| | | { |
| | | IStation.LogHelper.Info("Submit prj finish (fail) day:" + request.requestBase.StartTime + ",error:" + error); |
| | | return new IStation.Dto.ApiResult<string>(error) { Code = ApiResultCode.Error}; |
| | | return new IStation.Dto.ApiResult<string>(error) { Code = ApiResultCode.Error }; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | return new IStation.Dto.ApiResult<bool>(ret) { Code = ApiResultCode.Success }; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |