Модель и сервисы для значений операций

This commit is contained in:
Lyudmila Romanova 2022-06-07 16:24:05 +05:00
parent 9ae268f4c5
commit 6d44dadb27
9 changed files with 6236 additions and 0 deletions

View File

@ -0,0 +1,44 @@
namespace AsbCloudApp.Data
{
/// <summary>
/// Описание целевых/нормативных показателей операций
/// </summary>
public class OperationValueDto : IId
{
/// <summary>
/// Идентификатор в БД
/// </summary>
public int Id { get; set; }
/// <summary>
/// Идентификатор скважины
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Идентификатор категории операции
/// </summary>
public int IdOperationCategory { get; set; }
/// <summary>
/// Целевой показатель
/// </summary>
public double TargetValue { get; set; }
/// <summary>
/// Нормативный показатель
/// </summary>
public double StandardValue { get; set; }
/// <summary>
/// Стартовая глубина
/// </summary>
public double DepthStart { get; set; }
/// <summary>
/// Конечная глубина
/// </summary>
public double DepthEnd { get; set; }
}
}

View File

@ -0,0 +1,8 @@
using AsbCloudApp.Data;
namespace AsbCloudApp.Services
{
public interface IOperationValueService : ICrudService<OperationValueDto>
{
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class AddOperationValue : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_operationvalue",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Ид скважины"),
id_operation_category = table.Column<int>(type: "integer", nullable: false, comment: "Ид категории операции"),
target_value = table.Column<double>(type: "double precision", nullable: false, comment: "Целевой показатель"),
standard_value = table.Column<double>(type: "double precision", nullable: false, comment: "Нормативный показатель"),
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Старотовая глубина"),
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Конечная глубина")
},
constraints: table =>
{
table.PrimaryKey("PK_t_operationvalue", x => x.id);
table.ForeignKey(
name: "FK_t_operationvalue_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_operationvalue_t_well_operation_category_id_operation_cat~",
column: x => x.id_operation_category,
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Целевые/нормативные показатели операции");
migrationBuilder.CreateIndex(
name: "IX_t_operationvalue_id_operation_category",
table: "t_operationvalue",
column: "id_operation_category");
migrationBuilder.CreateIndex(
name: "IX_t_operationvalue_id_well",
table: "t_operationvalue",
column: "id_well");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_operationvalue");
}
}
}

View File

@ -46,6 +46,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<WellType> WellTypes => Set<WellType>();
public virtual DbSet<Driller> Drillers => Set<Driller>();
public virtual DbSet<Schedule> Schedule => Set<Schedule>();
public virtual DbSet<OperationValue> OperationValues => Set<OperationValue>();
// WITS
public DbSet<WITS.Record1> Record1 => Set<WITS.Record1>();

View File

@ -45,6 +45,7 @@ namespace AsbCloudDb.Model
DbSet<WellType> WellTypes { get; }
DbSet<Driller> Drillers { get; }
DbSet<Schedule> Schedule { get; }
DbSet<OperationValue> OperationValues { get; }
DbSet<Record1> Record1 { get; }
DbSet<Record7> Record7 { get; }

View File

@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudDb.Model
{
[Table("t_operationvalue"), Comment("Целевые/нормативные показатели операции")]
public class OperationValue:IId
{
[Key]
[Column("id"), Comment("Идентификатор")]
public int Id { get; set; }
[Column("id_well"), Comment("Ид скважины")]
public int IdWell { get; set; }
[Column("id_operation_category"), Comment("Ид категории операции")]
public int IdOperationCategory { get; set; }
[Column("target_value"), Comment("Целевой показатель")]
public double TargetValue { get; set; }
[Column("standard_value"), Comment("Нормативный показатель")]
public double StandardValue { get; set; }
[Column("depth_start"), Comment("Старотовая глубина")]
public double DepthStart { get; set; }
[Column("depth_end"), Comment("Конечная глубина")]
public double DepthEnd { get; set; }
[ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; } = null!;
[ForeignKey(nameof(IdOperationCategory))]
public virtual WellOperationCategory OperationCategory { get; set; } = null!;
}
}

View File

@ -0,0 +1,13 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
namespace AsbCloudInfrastructure.Services
{
public class OperationValueService : CrudServiceBase<OperationValueDto, OperationValue>, IOperationValueService
{
public OperationValueService(IAsbCloudDbContext context) : base(context)
{
}
}
}

View File

@ -0,0 +1,17 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace AsbCloudWebApi.Controllers
{
[Route("api/operationvalue")]
[ApiController]
[Authorize]
public class OperationValueController : CrudController<OperationValueDto, IOperationValueService>
{
public OperationValueController(IOperationValueService service) : base(service)
{
}
}
}