using Microsoft.AspNetCore.Mvc;
|
using System.Net;
|
using System.Net.Http.Headers;
|
using Microsoft.Extensions.Hosting.Internal;
|
using Microsoft.AspNetCore.Http.Extensions;
|
using IStation.Untity;
|
using Furion.DynamicApiController;
|
using System.ComponentModel.DataAnnotations;
|
using Mapster;
|
|
|
namespace IStation.Application
|
{
|
/// <summary>
|
/// PumpCurve
|
/// </summary>
|
[Route("Product/ParallelCurve")]
|
[NonUnify]
|
[ApiDescriptionSettings("Product", Name = "²¢ÁªÇúÏß", Order = 401)]
|
public class ParallelCurve_Controller : IDynamicApiController
|
{
|
|
private readonly Service.PumpCurve _service = new Service.PumpCurve();
|
|
|
/// <summary>
|
/// ¼ÆËã¹Ü·²¢ÁªÇúÏßÍØÕ¹£¨°üº¬µ¥±ÃÇúÏߣ©
|
/// </summary>
|
[Route("CalculatePipeLineParallelEx")]
|
[HttpPost]
|
public IStation.Dto.ApiResult CalculatePipeLineParallelEx(ViewModel.PipeLineParallelCurveRequest model)
|
{
|
//if (model == null)
|
//{
|
return new IStation.Dto.ApiResult(IStation.Dto.ApiResultCode.Alert, "´úÂëÕûÀíÖÐ");
|
//}
|
//if (model.CorpID < 1)
|
//{
|
// return new IStation.Dto.ApiResult(IStation.Dto.ApiResultCode.Alert, "CorpID ²ÎÊý´íÎó");
|
//}
|
//if (model.Items == null || model.Items.Count < 1)
|
//{
|
// return new IStation.Dto.ApiResult (IStation.Dto.ApiResultCode.Alert, "²¢Áª²ÎÊý´íÎó");
|
//}
|
|
//var service_pipe = new Service.PipeLine();
|
//var service_binding = new Service.PipeLineBinding();
|
//var service_product = new Service.Product();
|
//var service_curve = new Service.PumpCurveExMapping();
|
//var vm_list = new List<ViewModel.ParallelCurveEx>();
|
|
//var curve_qh_list = new List<Model.CurveExpress>();
|
//var curve_qp_list = new List<Model.CurveExpress>();
|
//var h_min = double.MinValue;
|
//var h_max = double.MaxValue;
|
|
//foreach (var item in model.Items)
|
//{
|
// var pipe = service_pipe.GetByID(model.CorpID, item.PipeLineID);
|
// if (pipe == null)
|
// continue;
|
// var binding_list = service_binding.GetUseByPipeLineID(model.CorpID, item.PipeLineID);
|
// if (binding_list == null || binding_list.Count < 1)
|
// continue;
|
// var binding = binding_list.Find(x => x.ObjectType == ObjectType.Product_É豸);
|
// if (binding == null)
|
// continue;
|
// var pump = service_product.GetChildPumpByEnginePumpID(binding.CorpID, binding.ObjectID);
|
// if (pump == null)
|
// continue;
|
// var curve = service_curve.GetDefaultWorkingByPumpID(pump.CorpID, pump.ID);
|
// if (curve == null)
|
// continue;
|
|
// if (item.HZ > 49.5)
|
// {
|
// if (curve.CurveInfo != null && curve.CurveInfo.CurveQH != null)
|
// {
|
// curve_qh_list.Add(curve.CurveInfo.CurveQH);
|
// if (curve.CurveInfo.CurveQP != null)
|
// {
|
// curve_qp_list.Add(curve.CurveInfo.CurveQP);
|
// }
|
// }
|
// }
|
// else
|
// {
|
// var curve_qh = curve.CalcuCurveQhByHz(item.HZ);
|
// if (curve_qh != null)
|
// {
|
// curve_qh_list.Add(curve_qh);
|
// var curve_qp = curve.CalcuCurveQpByHz(item.HZ);
|
// if (curve_qp != null)
|
// {
|
// curve_qp_list.Add(curve_qp);
|
// }
|
// }
|
// }
|
|
// var curve_qh_last = curve_qh_list.LastOrDefault();
|
// if (curve_qh_last != null)
|
// {
|
// var curve_qh_first_point = curve_qh_last.GetFirstFitPoint();
|
// h_max = Math.Min(h_max, curve_qh_first_point.Y);
|
// var curve_qh_last_point = curve_qh_last.GetLastFitPoint();
|
// h_min = Math.Max(h_min, curve_qh_last_point.Y);
|
// }
|
// var vm_parallel_curve = new ViewModel.ParallelCurveEx();
|
// vm_parallel_curve.Type = 0;
|
// vm_parallel_curve.Name = pipe.Name;
|
// vm_parallel_curve.PointQH = curve_qh_list.LastOrDefault()?.GetFitPoints(20)?.Select(x => new ViewModel.CurvePoint(x)).ToList();
|
// vm_parallel_curve.PointQP = curve_qp_list.LastOrDefault()?.GetFitPoints(20)?.Select(x => new ViewModel.CurvePoint(x)).ToList();
|
// vm_list.Add(vm_parallel_curve);
|
//}
|
|
//if (curve_qh_list.Count < 2)
|
//{
|
// return new Result(Code.Alert, "NULL1");
|
//}
|
//if (h_max < h_min)
|
//{
|
// return new Result(Code.Alert, "NULL2");
|
//}
|
|
//double space_h = (h_max - h_min) / 19;
|
//var points_qh_parallel = new List<Model.CurvePoint>();
|
//var points_qp_parallel = new List<Model.CurvePoint>();
|
|
//for (var h = h_min; h <= h_max; h = h + space_h)
|
//{
|
// double total_flow = 0;
|
// double total_power = 0;
|
|
// for (int j = 0; j < curve_qh_list.Count; j++)
|
// {
|
// var curve_qh = curve_qh_list[j];
|
// var curve_qp = curve_qp_list[j];
|
// var pts = Model.FitCurveHelper.GetInterPointX(curve_qh, h);
|
// if (pts != null && pts.Count > 0)
|
// {
|
// var q = pts.Last().X;
|
// total_flow += q;
|
// total_power += curve_qp.GetFitPointY(q);
|
// }
|
// }
|
// points_qh_parallel.Add(new Model.CurvePoint(total_flow, h));
|
// points_qp_parallel.Add(new Model.CurvePoint(total_flow, total_power));
|
//}
|
|
//var vm = new ViewModel.ParallelCurveEx();
|
//vm.Type = 1;
|
//vm.Name = "²¢ÁªÇúÏß";
|
//vm.PointQH = Model.FitCurveHelper.GetFitPoints(points_qh_parallel, 20)?.Select(x => new ViewModel.CurvePoint(x)).ToList();
|
//vm.PointQP = Model.FitCurveHelper.GetFitPoints(points_qp_parallel, 20)?.Select(x => new ViewModel.CurvePoint(x)).ToList();
|
//vm_list.Insert(0, vm);
|
//return new Result<List<ViewModel.ParallelCurveEx>>(vm_list);
|
}
|
|
|
|
|
|
}
|
}
|