forked from ddrilling/AsbCloudServer
Получение списков ограничивающих параметров и подсистем
This commit is contained in:
parent
6ef633d607
commit
29d4121440
@ -19,6 +19,12 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<LimitingParameterDto>> GetStatAsync(LimitingParameterRequest request, CancellationToken token);
|
Task<IEnumerable<LimitingParameterDto>> GetStatAsync(LimitingParameterRequest request, CancellationToken token);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение списка ограничений
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Dictionary<int, string> GetLimitingParameteraNames();
|
||||||
}
|
}
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
private readonly ILimitingParameterRepository limitingParameterRepository;
|
private readonly ILimitingParameterRepository limitingParameterRepository;
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
private readonly Dictionary<int, string> feedRegulatorData = new Dictionary<int, string>()
|
private readonly Dictionary<int, string> feedRegulatorData = new ()
|
||||||
{
|
{
|
||||||
{ 0, "Нет ограничения" },
|
{ 0, "Нет ограничения" },
|
||||||
{ 1, "МСП" },
|
{ 1, "МСП" },
|
||||||
@ -63,6 +63,11 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<int, string> GetLimitingParameteraNames() //TODO: Перенести получение ограничений в репозиторий
|
||||||
|
{
|
||||||
|
return feedRegulatorData;
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<LimitingParameterDataDto> TrimLimitingParameters(IEnumerable<LimitingParameterDataDto> data, LimitingParameterRequest request)
|
private IEnumerable<LimitingParameterDataDto> TrimLimitingParameters(IEnumerable<LimitingParameterDataDto> data, LimitingParameterRequest request)
|
||||||
{
|
{
|
||||||
var result = data.Select((x) =>
|
var result = data.Select((x) =>
|
||||||
|
@ -40,6 +40,18 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Ok(subsystemResult);
|
return Ok(subsystemResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение словаря названий ограничений
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("names")]
|
||||||
|
[ProducesResponseType(typeof(Dictionary<int, string>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
|
public IActionResult GetLimitingParameteraNames()
|
||||||
|
{
|
||||||
|
var feedRegulatorData = limitingParameterService.GetLimitingParameteraNames();
|
||||||
|
return Ok(feedRegulatorData);
|
||||||
|
}
|
||||||
|
|
||||||
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var idCompany = User.GetCompanyId();
|
var idCompany = User.GetCompanyId();
|
||||||
|
@ -3,7 +3,6 @@ using AsbCloudApp.Requests;
|
|||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudApp.Services.Subsystems;
|
using AsbCloudApp.Services.Subsystems;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -25,6 +24,14 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
|||||||
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
private readonly ISubsystemService subsystemService;
|
private readonly ISubsystemService subsystemService;
|
||||||
|
|
||||||
|
private readonly Dictionary<int, string> subsystemNames = new()
|
||||||
|
{
|
||||||
|
{ 1, "SAUB" },
|
||||||
|
{ 65537, "Torque Master" },
|
||||||
|
{ 65536, "Spin Master" }
|
||||||
|
};
|
||||||
|
|
||||||
public SubsystemOperationTimeController(ISubsystemOperationTimeService subsystemOperationTimeService, IWellService wellService, ISubsystemService subsystemService)
|
public SubsystemOperationTimeController(ISubsystemOperationTimeService subsystemOperationTimeService, IWellService wellService, ISubsystemService subsystemService)
|
||||||
{
|
{
|
||||||
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
||||||
@ -131,6 +138,17 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение словаря названий подсистем
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("names")]
|
||||||
|
[ProducesResponseType(typeof(Dictionary<int, string>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
|
public IActionResult GetSubsystemsNames()
|
||||||
|
{
|
||||||
|
return Ok(subsystemNames);
|
||||||
|
}
|
||||||
|
|
||||||
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var idCompany = User.GetCompanyId();
|
var idCompany = User.GetCompanyId();
|
||||||
|
Loading…
Reference in New Issue
Block a user