forked from ddrilling/AsbCloudServer
#7987467 правки
This commit is contained in:
parent
4f100e6bc4
commit
398a6d443e
@ -21,6 +21,11 @@ namespace AsbCloudApp.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int IdWell { get; set; }
|
public int IdWell { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Id пользователя
|
||||||
|
/// </summary>
|
||||||
|
public int IdUser { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Тип секции
|
/// Тип секции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -44,27 +49,27 @@ namespace AsbCloudApp.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Нагрузка
|
/// Нагрузка
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PlanFactDto? AxialLoad { get; set; }
|
public PlanFactDto AxialLoad { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перепад давления
|
/// Перепад давления
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PlanFactDto? Pressure { get; set; }
|
public PlanFactDto Pressure { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Момент на ВСП
|
/// Момент на ВСП
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PlanFactDto? TopDriveTorque { get; set; }
|
public PlanFactDto TopDriveTorque { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обороты на ВСП
|
/// Обороты на ВСП
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PlanFactDto? TopDriveSpeed { get; set; }
|
public PlanFactDto TopDriveSpeed { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Расход
|
/// Расход
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PlanFactDto? Flow { get; set; }
|
public PlanFactDto Flow { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Плановая механическая скорость, м/ч
|
/// Плановая механическая скорость, м/ч
|
||||||
|
@ -9,7 +9,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// ÐÒÊ
|
/// ÐÒÊ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IDrillFlowChartRepository : IRepositoryWellRelated<ProcessMapDto>
|
public interface IProcessMapRepository : IRepositoryWellRelated<ProcessMapDto>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ïîëó÷èòü ïàðàìåòðû áóðåíèÿ íà÷èíàÿ ñ äàòû.
|
/// Ïîëó÷èòü ïàðàìåòðû áóðåíèÿ íà÷èíàÿ ñ äàòû.
|
||||||
@ -19,6 +19,6 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
|
Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
|
||||||
DateTime updateFrom, CancellationToken token = default);
|
DateTime? updateFrom, CancellationToken token = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
6487
AsbCloudDb/Migrations/20221206091023_UpdateTable_t_process_map_add_user_id.Designer.cs
generated
Normal file
6487
AsbCloudDb/Migrations/20221206091023_UpdateTable_t_process_map_add_user_id.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class UpdateTable_t_process_map_add_user_id : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "id_user",
|
||||||
|
table: "t_process_map",
|
||||||
|
type: "integer",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
comment: "Id пользователя");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_process_map_id_user",
|
||||||
|
table: "t_process_map",
|
||||||
|
column: "id_user");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_t_process_map_t_user_id_user",
|
||||||
|
table: "t_process_map",
|
||||||
|
column: "id_user",
|
||||||
|
principalTable: "t_user",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_t_process_map_t_user_id_user",
|
||||||
|
table: "t_process_map");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_t_process_map_id_user",
|
||||||
|
table: "t_process_map");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "id_user",
|
||||||
|
table: "t_process_map");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6477
AsbCloudDb/Migrations/20221207034419_UpdateTable_t_process_map_delete_fk.Designer.cs
generated
Normal file
6477
AsbCloudDb/Migrations/20221207034419_UpdateTable_t_process_map_delete_fk.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
public partial class UpdateTable_t_process_map_delete_fk : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_t_process_map_t_user_id_user",
|
||||||
|
table: "t_process_map");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_t_process_map_id_user",
|
||||||
|
table: "t_process_map");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_process_map_id_user",
|
||||||
|
table: "t_process_map",
|
||||||
|
column: "id_user");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_t_process_map_t_user_id_user",
|
||||||
|
table: "t_process_map",
|
||||||
|
column: "id_user",
|
||||||
|
principalTable: "t_user",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1801,6 +1801,11 @@ namespace AsbCloudDb.Migrations
|
|||||||
.HasColumnName("flow_plan")
|
.HasColumnName("flow_plan")
|
||||||
.HasComment("Расход, план");
|
.HasComment("Расход, план");
|
||||||
|
|
||||||
|
b.Property<int>("IdUser")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id_user")
|
||||||
|
.HasComment("Id пользователя");
|
||||||
|
|
||||||
b.Property<int>("IdWell")
|
b.Property<int>("IdWell")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("well_id")
|
.HasColumnName("well_id")
|
||||||
|
@ -17,6 +17,9 @@ namespace AsbCloudDb.Model
|
|||||||
[Column("well_id"), Comment("Id скважины")]
|
[Column("well_id"), Comment("Id скважины")]
|
||||||
public int IdWell { get; set; }
|
public int IdWell { get; set; }
|
||||||
|
|
||||||
|
[Column("id_user"), Comment("Id пользователя")]
|
||||||
|
public int IdUser { get; set; }
|
||||||
|
|
||||||
[Column("id_wellsection_type"), Comment("Тип секции")]
|
[Column("id_wellsection_type"), Comment("Тип секции")]
|
||||||
public int IdWellSectionType { get; set; }
|
public int IdWellSectionType { get; set; }
|
||||||
|
|
||||||
@ -64,11 +67,11 @@ namespace AsbCloudDb.Model
|
|||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[ForeignKey(nameof(IdWell))]
|
[ForeignKey(nameof(IdWell))]
|
||||||
public virtual Well? Well { get; set; }
|
public virtual Well? Well { get; set; } = null!;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[ForeignKey(nameof(IdWellSectionType))]
|
[ForeignKey(nameof(IdWellSectionType))]
|
||||||
public virtual WellSectionType? WellSectionType { get; set; }
|
public virtual WellSectionType? WellSectionType { get; set; } = null!;
|
||||||
}
|
}
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ namespace AsbCloudInfrastructure
|
|||||||
|
|
||||||
services.AddTransient<IAuthService, AuthService>();
|
services.AddTransient<IAuthService, AuthService>();
|
||||||
services.AddTransient<IClusterService, ClusterService>();
|
services.AddTransient<IClusterService, ClusterService>();
|
||||||
services.AddTransient<IDrillFlowChartRepository, ProcessMapRepository>();
|
services.AddTransient<IProcessMapRepository, ProcessMapRepository>();
|
||||||
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
||||||
services.AddTransient<IEventService, EventService>();
|
services.AddTransient<IEventService, EventService>();
|
||||||
services.AddTransient<FileService>();
|
services.AddTransient<FileService>();
|
||||||
|
@ -12,24 +12,27 @@ using System.Threading.Tasks;
|
|||||||
namespace AsbCloudInfrastructure.Repository
|
namespace AsbCloudInfrastructure.Repository
|
||||||
{
|
{
|
||||||
public class ProcessMapRepository : CrudWellRelatedServiceBase<ProcessMapDto, ProcessMap>,
|
public class ProcessMapRepository : CrudWellRelatedServiceBase<ProcessMapDto, ProcessMap>,
|
||||||
IDrillFlowChartRepository
|
IProcessMapRepository
|
||||||
{
|
{
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
|
|
||||||
public ProcessMapRepository(IAsbCloudDbContext context, IWellService wellService)
|
public ProcessMapRepository(IAsbCloudDbContext context, IWellService wellService)
|
||||||
: base(context)
|
: base(context, dbSet =>
|
||||||
|
dbSet.Include(x => x.Well)
|
||||||
|
.Include(x => x.WellSectionType)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
|
public async Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
|
||||||
DateTime updateFrom, CancellationToken token = default)
|
DateTime? updateFrom, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var timezone = wellService.GetTimezone(idWell);
|
var timezone = wellService.GetTimezone(idWell);
|
||||||
var updateFromUtc = updateFrom.ToUtcDateTimeOffset(timezone.Hours);
|
var updateFromUtc = updateFrom?.ToUtcDateTimeOffset(timezone.Hours);
|
||||||
var entities = await GetQuery()
|
var entities = await GetQuery()
|
||||||
.Where(e => e.IdWell == idWell)
|
.Where(e => e.IdWell == idWell)
|
||||||
.Where(e => e.LastUpdate == updateFromUtc)
|
.Where(e => e.LastUpdate >= updateFromUtc)
|
||||||
.OrderBy(e => e.DepthStart)
|
.OrderBy(e => e.DepthStart)
|
||||||
.ThenBy(e => e.Id)
|
.ThenBy(e => e.Id)
|
||||||
.ToListAsync(token)
|
.ToListAsync(token)
|
||||||
@ -62,35 +65,34 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
protected override ProcessMapDto Convert(ProcessMap entity)
|
protected override ProcessMapDto Convert(ProcessMap entity)
|
||||||
{
|
{
|
||||||
return new ProcessMapDto {
|
var dto = entity.Adapt<ProcessMapDto>();
|
||||||
Id = entity.Id,
|
dto.LastUpdate = entity.LastUpdate.ToRemoteDateTime(entity.Well.Timezone.Hours);
|
||||||
IdWell = entity.IdWell,
|
dto.AxialLoad = new PlanFactDto
|
||||||
LastUpdate = entity.LastUpdate,
|
{
|
||||||
IdWellSectionType = entity.IdWellSectionType,
|
|
||||||
DepthEnd = entity.DepthEnd,
|
|
||||||
DepthStart = entity.DepthStart,
|
|
||||||
AxialLoad = new PlanFactDto {
|
|
||||||
Fact = entity.AxialLoadFact,
|
Fact = entity.AxialLoadFact,
|
||||||
Plan = entity.AxialLoadPlan
|
Plan = entity.AxialLoadPlan
|
||||||
},
|
};
|
||||||
Flow = new PlanFactDto {
|
dto.Flow = new PlanFactDto
|
||||||
|
{
|
||||||
Fact = entity.FlowFact,
|
Fact = entity.FlowFact,
|
||||||
Plan = entity.FlowPlan
|
Plan = entity.FlowPlan
|
||||||
},
|
};
|
||||||
Pressure = new PlanFactDto {
|
dto.Pressure = new PlanFactDto
|
||||||
|
{
|
||||||
Fact = entity.FlowFact,
|
Fact = entity.FlowFact,
|
||||||
Plan = entity.FlowPlan
|
Plan = entity.FlowPlan
|
||||||
},
|
};
|
||||||
TopDriveSpeed = new PlanFactDto {
|
dto.TopDriveSpeed = new PlanFactDto
|
||||||
|
{
|
||||||
Fact = entity.TopDriveSpeedFact,
|
Fact = entity.TopDriveSpeedFact,
|
||||||
Plan = entity.TopDriveSpeedPlan
|
Plan = entity.TopDriveSpeedPlan
|
||||||
},
|
};
|
||||||
TopDriveTorque = new PlanFactDto {
|
dto.TopDriveTorque = new PlanFactDto
|
||||||
|
{
|
||||||
Fact = entity.TopDriveTorqueFact,
|
Fact = entity.TopDriveTorqueFact,
|
||||||
Plan = entity.TopDriveTorquePlan
|
Plan = entity.TopDriveTorquePlan
|
||||||
},
|
|
||||||
RopPlan = entity.RopPlan
|
|
||||||
};
|
};
|
||||||
|
return dto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,11 +15,11 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class ProcessMapController : CrudWellRelatedController<ProcessMapDto, IDrillFlowChartRepository>
|
public class ProcessMapController : CrudWellRelatedController<ProcessMapDto, IProcessMapRepository>
|
||||||
{
|
{
|
||||||
private readonly ITelemetryService telemetryService;
|
private readonly ITelemetryService telemetryService;
|
||||||
|
|
||||||
public ProcessMapController(IWellService wellService, IDrillFlowChartRepository service,
|
public ProcessMapController(IWellService wellService, IProcessMapRepository service,
|
||||||
ITelemetryService telemetryService)
|
ITelemetryService telemetryService)
|
||||||
: base(wellService, service)
|
: base(wellService, service)
|
||||||
{
|
{
|
||||||
@ -57,9 +57,35 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{wellId}")]
|
[Route("{wellId}")]
|
||||||
public IActionResult GetExtendedRTCAsync(int wellId)
|
public IActionResult GetReportFileAsync(int wellId)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавить запись
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public override async Task<ActionResult<int>> InsertAsync([FromBody] ProcessMapDto value, CancellationToken token)
|
||||||
|
{
|
||||||
|
value.IdUser = User.GetUserId() ?? -1;
|
||||||
|
return await base.InsertAsync(value, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
// <summary>
|
||||||
|
/// Редактировать запись по id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">запись</param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns>1 - успешно отредактировано, 0 - нет</returns>
|
||||||
|
[HttpPut]
|
||||||
|
public override async Task<ActionResult<int>> UpdateAsync([FromBody] ProcessMapDto value, CancellationToken token)
|
||||||
|
{
|
||||||
|
value.IdUser = User.GetUserId() ?? -1;
|
||||||
|
return await base.InsertAsync(value, token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user