| | |
| | | using IStation.Common; |
| | | using IStation.CalcModel; |
| | | using IStation.Common; |
| | | using IStation.Dto; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | |
| | | |
| | | public class SavePrjRequest |
| | | { |
| | | public string day { get; set; } |
| | | public Model.AnaSetting settting { get; set; } |
| | | public Model.AnaRequestBase requestBase { get; set; } |
| | | { |
| | | 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; } |
| | | } |
| | |
| | | [HttpPost] |
| | | public async Task<IStation.Dto.ApiResult> SavePrj([FromBody] SavePrjRequest request) |
| | | { |
| | | if (request == null || request.day == null) |
| | | if (request == null ) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day null" }; |
| | | } |
| | |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "prj null" }; |
| | | } |
| | | DateTime d; |
| | | if (!DateTime.TryParse(request.day, out d)) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 格式不正确" }; |
| | | } |
| | | var ret = Common.HistoryAnaPrjFileHelper.SavePrj(d, request.settting, request.requestBase, request.prj); |
| | | |
| | | var ret = Common.HistoryAnaPrjFileHelper.SavePrj( request.settting, request.requestBase, request.prj); |
| | | |
| | | if (request.isSubmit) |
| | | { |
| | |
| | | |
| | | if(!string.IsNullOrEmpty(error)) |
| | | { |
| | | IStation.LogHelper.Info("Submit prj finish (fail) day:" + request.day+ ",error:" + error); |
| | | IStation.LogHelper.Info("Submit prj finish (fail) day:" + request.requestBase.StartTime + ",error:" + error); |
| | | return new IStation.Dto.ApiResult<string>(error) { Code = ApiResultCode.Error}; |
| | | } |
| | | else |
| | | { |
| | | IStation.LogHelper.Info("Submit prj finish (success) day:" + request.day); |
| | | IStation.LogHelper.Info("Submit prj finish (success) day:" + request.requestBase.StartTime); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <returns></returns> |
| | | [Route("CalcPrj")] |
| | | [HttpPost] |
| | | public async Task<IStation.Dto.ApiResult> CalcPrj([FromBody] SavePrjRequest request) |
| | | { |
| | | if (request == null ) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day null" }; |
| | | } |
| | | if (request.prj == null) |
| | | { |
| | | return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "prj null" }; |
| | | } |
| | | |
| | | var ret = Common.HistoryAnaPrjFileHelper.SavePrj( request.settting, request.requestBase, request.prj); |
| | | |
| | | if (request.isSubmit) |
| | | { |
| | | string error = await ZyConnectHelper.SubmitPrj(request.prj);//, (id) => { IStation.LogHelper.Info("SavePrj success id=" + id); }, (info) => { IStation.LogHelper.Info("SavePrj failse info:" + info); });//.Result; |
| | | |
| | | |
| | | |
| | | |
| | | 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 }; |
| | | } |
| | | else |
| | | { |
| | | IStation.LogHelper.Info("Submit prj finish (success) day:" + request.requestBase.StartTime); |
| | | } |
| | | } |
| | | |
| | | |
| | | return new IStation.Dto.ApiResult<bool>(ret) { Code = ApiResultCode.Success }; |
| | | } |
| | | |
| | | |
| | | |