forked from ddrilling/AsbCloudServer
Добавление новых категорий
This commit is contained in:
parent
bf0c3806ad
commit
96b96a0a22
@ -1,72 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Add_NewWellOperationCategories : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "t_well_operation_category",
|
||||
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 3006, null, "dT", "мин", "Заключительные работы" },
|
||||
{ 5113, 4001, "МСП", "м/ч", "Бурение" },
|
||||
{ 5114, 4013, "dT", "мин", "ТО оборудования" },
|
||||
{ 5116, 4013, "dT", "мин", "Фрезерование \"Окна\"" },
|
||||
{ 5117, 4013, "dT", "мин", "Расширение ствола" },
|
||||
{ 4019, 3006, "dT", "мин", "Заключительные операции" },
|
||||
{ 5115, 4019, "dT", "мин", "Спуск НКТ" }
|
||||
});
|
||||
|
||||
migrationBuilder.Sql
|
||||
("UPDATE public.t_well_operation SET id_category=5113 WHERE id_category=5002 OR id_category=5003;");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 5113);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 5114);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 5115);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 5116);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 5117);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 4019);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_well_operation_category",
|
||||
keyColumn: "id",
|
||||
keyValue: 3006);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -397,7 +397,7 @@ namespace AsbCloudDb.Model
|
||||
new () {Id = 5113, IdParent = 4001, Name = "Бурение", KeyValueName = "МСП", KeyValueUnits = "м/ч"},
|
||||
new () {Id = 5114, IdParent = 4013, Name = "ТО оборудования", KeyValueName = "dT", KeyValueUnits = "мин"},
|
||||
new () {Id = 5115, IdParent = IdFinalOperations, Name = "Спуск НКТ", KeyValueName = "dT", KeyValueUnits = "мин"},
|
||||
new () {Id = 5116, IdParent = IdAuxiliaryWork, Name = "Фрезерование \"Окна\"", KeyValueName = "dT", KeyValueUnits = "мин"},
|
||||
new () {Id = 5116, IdParent = IdAuxiliaryWork, Name = "Вырезка окна", KeyValueName = "dT", KeyValueUnits = "мин"},
|
||||
new () {Id = 5117, IdParent = IdAuxiliaryWork, Name = "Расширение ствола", KeyValueName = "dT", KeyValueUnits = "мин"},
|
||||
};
|
||||
#endregion
|
||||
@ -418,6 +418,8 @@ namespace AsbCloudDb.Model
|
||||
[Column("key_value_units"), Comment("Единицы измерения ключевого показателя операции"), StringLength(16)]
|
||||
public string? KeyValueUnits { get; set; }
|
||||
|
||||
public bool IsHidden { get; set; } = false;
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(IdParent))]
|
||||
public virtual WellOperationCategory? Parent { get; set; } = null!;
|
||||
|
@ -0,0 +1,39 @@
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Repository;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ExcelServices
|
||||
{
|
||||
public class ExcelTemplateService<TTemplate> : ExcelExportService<WellOperationCategoryDto, WellOperationExportRequest, TTemplate>
|
||||
where TTemplate : class, ITemplateParameters, new()
|
||||
{
|
||||
private readonly IWellOperationCategoryRepository wellOperationCategoryRepository;
|
||||
|
||||
public ExcelTemplateService(IWellOperationCategoryRepository wellOperationCategoryRepository,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.wellOperationCategoryRepository = wellOperationCategoryRepository;
|
||||
}
|
||||
|
||||
protected override async Task<string> BuildFileNameAsync(WellOperationExportRequest options, CancellationToken token)
|
||||
{
|
||||
return "WellOperationFactTemplate";
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<WellOperationCategoryDto>> GetDtosAsync(WellOperationExportRequest options, CancellationToken token)
|
||||
{
|
||||
var dtos = wellOperationCategoryRepository.Get(false);
|
||||
return dtos;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
@ -71,7 +71,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return DateTimeOffset.MinValue;
|
||||
|
||||
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
|
||||
return datesRange.To.DateTime;
|
||||
return datesRange.To;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@ -16,6 +16,9 @@ using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Requests.ParserOptions;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services.WellOperations.Factories;
|
||||
using ClosedXML.Excel;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
using AsbCloudApp.Services.Export;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers;
|
||||
|
||||
@ -40,13 +43,15 @@ public class WellOperationController : ControllerBase
|
||||
|
||||
private readonly WellOperationParserFactory wellOperationParserFactory;
|
||||
private readonly WellOperationExportServiceFactory wellOperationExportServiceFactory;
|
||||
//private readonly IExportService<WellRelatedExportRequest> templateService;
|
||||
|
||||
public WellOperationController(IWellOperationRepository wellOperationRepository,
|
||||
public WellOperationController(IWellOperationRepository wellOperationRepository,
|
||||
IWellOperationCategoryRepository wellOperationCategoryRepository,
|
||||
IWellService wellService,
|
||||
IUserRepository userRepository,
|
||||
WellOperationParserFactory wellOperationParserFactory,
|
||||
WellOperationExportServiceFactory wellOperationExportServiceFactory)
|
||||
//IExportService<WellRelatedExportRequest> templateService
|
||||
{
|
||||
this.wellOperationRepository = wellOperationRepository;
|
||||
this.wellOperationCategoryRepository = wellOperationCategoryRepository;
|
||||
@ -54,7 +59,9 @@ public class WellOperationController : ControllerBase
|
||||
this.userRepository = userRepository;
|
||||
this.wellOperationParserFactory = wellOperationParserFactory;
|
||||
this.wellOperationExportServiceFactory = wellOperationExportServiceFactory;
|
||||
}
|
||||
//this.templateService = templateService;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавляет новые операции на скважине
|
||||
@ -317,12 +324,19 @@ public class WellOperationController : ControllerBase
|
||||
[HttpGet("template")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")]
|
||||
public IActionResult GetTemplate(int idType)
|
||||
public async Task<IActionResult> GetTemplate(int idType)
|
||||
{
|
||||
var parser = wellOperationParserFactory.CreateParser<WellOperationParserRequest>(idType);
|
||||
var stream = parser.GetTemplateFile();
|
||||
|
||||
//using var workbook = new XLWorkbook(stream);
|
||||
//AddDtosToWorkbook(workbook, dtos);
|
||||
|
||||
return File(stream, "application/octet-stream", templateNames[idType]);
|
||||
|
||||
//var exportOptions = new WellRelatedExportRequest(5);
|
||||
//var (fileName, file) = await templateService.ExportAsync(exportOptions, CancellationToken.None);
|
||||
//return File(file, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
|
@ -7,10 +7,10 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
|
||||
"DefaultConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"DebugConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
|
||||
"TestConnection": "Host=localhost;Database=test;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
|
||||
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
|
||||
"LocalConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ContentPath": "../data",
|
||||
|
Loading…
Reference in New Issue
Block a user