Актуализация полей шаблонов и изменение разделителя в файле экспорта
This commit is contained in:
1013
PARR.DAL/Migrations/20230913040417_TblTemplatesAddColumns.Designer.cs
generated
Normal file
1013
PARR.DAL/Migrations/20230913040417_TblTemplatesAddColumns.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
139
PARR.DAL/Migrations/20230913040417_TblTemplatesAddColumns.cs
Normal file
139
PARR.DAL/Migrations/20230913040417_TblTemplatesAddColumns.cs
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PARR.DAL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class TblTemplatesAddColumns : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "EKDateCreated",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ClosingCode",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Duration",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "FullDescription",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Initiator",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ResponseArea",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Solution",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "TNK",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Work",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Worker",
|
||||||
|
table: "Templates",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ClosingCode",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Duration",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "FullDescription",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Initiator",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Name",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ResponseArea",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Solution",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "TNK",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Work",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Worker",
|
||||||
|
table: "Templates");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTimeOffset>(
|
||||||
|
name: "EKDateCreated",
|
||||||
|
table: "Templates",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -387,27 +387,52 @@ namespace PARR.DAL.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ClosingCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("DateCreated")
|
b.Property<DateTimeOffset>("DateCreated")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("DateModified")
|
b.Property<DateTimeOffset?>("DateModified")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Duration")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("EK")
|
b.Property<string>("EK")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("EKDateCreated")
|
b.Property<string>("FullDescription")
|
||||||
.HasColumnType("timestamp with time zone");
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Initiator")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Process")
|
b.Property<string>("Process")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ResponseArea")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("ShortDescription")
|
b.Property<string>("ShortDescription")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Solution")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Status")
|
b.Property<string>("Status")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
@@ -416,10 +441,22 @@ namespace PARR.DAL.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("TNK")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Work")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("WorkGroup")
|
b.Property<string>("WorkGroup")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Worker")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<bool>("isActive")
|
b.Property<bool>("isActive")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,23 @@ namespace PARR.DAL.Models
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public DateTimeOffset DateCreated { get; set; }
|
public DateTimeOffset DateCreated { get; set; }
|
||||||
public DateTimeOffset? DateModified { get; set; }
|
public DateTimeOffset? DateModified { get; set; }
|
||||||
public required string EK { get; set; }
|
public required string Name { get; set; }
|
||||||
public bool isActive { get; set; }
|
public bool isActive { get; set; }
|
||||||
public required string WorkGroup { get; set; }
|
public required string WorkGroup { get; set; }
|
||||||
public required string ShortDescription { get; set; }
|
public required string ShortDescription { get; set; }
|
||||||
public required string Category { get; set; }
|
public required string Category { get; set; }
|
||||||
public DateTimeOffset? EKDateCreated { get; set; }
|
public required string ResponseArea { get; set; }
|
||||||
public required string Process { get; set; }
|
public required string Duration { get; set; }
|
||||||
|
public required string EK { get; set; }
|
||||||
|
public required string Initiator { get; set; }
|
||||||
|
public required string FullDescription { get; set; }
|
||||||
|
public required string ClosingCode { get; set; }
|
||||||
|
public required string Solution { get; set; }
|
||||||
|
public required string Process { get; set; }
|
||||||
public required string SubProcess { get; set; }
|
public required string SubProcess { get; set; }
|
||||||
|
public required string TNK { get; set; }
|
||||||
|
public required string Work { get; set; }
|
||||||
|
public required string Worker { get; set; }
|
||||||
public required string Status { get; set; }
|
public required string Status { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
|
|
||||||
public async Task<Template?> GetTemplateByNameAsync(string name)
|
public async Task<Template?> GetTemplateByNameAsync(string name)
|
||||||
{
|
{
|
||||||
return await EntitySet.FirstOrDefaultAsync(t => t.EK == name);
|
return await EntitySet.FirstOrDefaultAsync(t => t.Name == name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace PARR.EsppTemplateSync.Services
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var template = await templateService.GetTemplateByNameAsync(esppTemplate.EK);
|
var template = await templateService.GetTemplateByNameAsync(esppTemplate.Name);
|
||||||
//существует в ЕСПП но отсутствует в ПАРР.
|
//существует в ЕСПП но отсутствует в ПАРР.
|
||||||
//TODO деактивируем и видимо ещё что-то нужно
|
//TODO деактивируем и видимо ещё что-то нужно
|
||||||
if (template == null)
|
if (template == null)
|
||||||
@@ -80,10 +80,10 @@ namespace PARR.EsppTemplateSync.Services
|
|||||||
esppTemplate.isActive = false;
|
esppTemplate.isActive = false;
|
||||||
if (!await templateService.CreateAsync(esppTemplate) || !await templateService.CommitAsync())
|
if (!await templateService.CreateAsync(esppTemplate) || !await templateService.CommitAsync())
|
||||||
{
|
{
|
||||||
logger.LogError($"Не удалось создать запись Template {esppTemplate.EK}({esppTemplate.ShortDescription})");
|
logger.LogError($"Не удалось создать запись Template {esppTemplate.Name}({esppTemplate.ShortDescription})");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logger.LogInformation($"----- Создана запись Template {esppTemplate.EK}({esppTemplate.ShortDescription}) -----");
|
logger.LogInformation($"----- Создана запись Template {esppTemplate.Name}({esppTemplate.ShortDescription}) -----");
|
||||||
//TODO написать проверку успешности деактивации и удаление строки из таблицы Templates
|
//TODO написать проверку успешности деактивации и удаление строки из таблицы Templates
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -27,33 +27,54 @@ namespace PARR.EsppTemplateSync.Services
|
|||||||
//TODO: а если формат нет тот? Все будет ок?
|
//TODO: а если формат нет тот? Все будет ок?
|
||||||
|
|
||||||
//TODO:
|
//TODO:
|
||||||
var splittedContent = str.Split(";");
|
var splittedContent = str.Split("<|>");
|
||||||
if (splittedContent.Length != 8) return null;
|
if (splittedContent.Length != 17)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var ek = splittedContent[0].Trim().Substring(1, splittedContent[0].Length - 2);
|
//var name = splittedContent[0].Trim().Substring(1, splittedContent[0].Length - 2);
|
||||||
var isActive = splittedContent[1].Trim().Substring(1, splittedContent[1].Length - 2);
|
var name = splittedContent[0].Trim();
|
||||||
var workGroup = splittedContent[2].Trim().Substring(1, splittedContent[2].Length - 2);
|
var isActive = splittedContent[1].Trim();
|
||||||
var shortDescription = splittedContent[3].Trim().Substring(1, splittedContent[3].Length - 2);
|
var workGroup = splittedContent[2].Trim();
|
||||||
var category = splittedContent[4].Trim().Substring(1, splittedContent[4].Length - 2);
|
var shortDescription = splittedContent[3].Trim();
|
||||||
var ekDateCreatedStr = splittedContent[5].Trim().Substring(1, splittedContent[5].Length - 2);
|
var category = splittedContent[4].Trim();
|
||||||
var process = splittedContent[6].Trim().Substring(1, splittedContent[6].Length - 2);
|
var responseArea = splittedContent[5].Trim();
|
||||||
var subProcess = splittedContent[7].Trim().Substring(1, splittedContent[7].Length - 2);
|
var duration = splittedContent[6].Trim();
|
||||||
|
var ek = splittedContent[7].Trim();
|
||||||
|
var initiator = splittedContent[8].Trim();
|
||||||
|
|
||||||
|
var fullDescription = splittedContent[9].Trim();
|
||||||
|
var closingCode = splittedContent[10].Trim();
|
||||||
|
var solution = splittedContent[11].Trim();
|
||||||
|
var process = splittedContent[12].Trim();
|
||||||
|
var subProcess = splittedContent[13].Trim();
|
||||||
|
var tnk = splittedContent[14].Trim();
|
||||||
|
var work = splittedContent[15].Trim();
|
||||||
|
var worker = splittedContent[16].Trim();
|
||||||
|
|
||||||
//logger.LogInformation($"Получено сообщение: {ek}");
|
//logger.LogInformation($"Получено сообщение: {ek}");
|
||||||
var template = new Template
|
var template = new Template
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
DateCreated = DateTime.UtcNow,
|
DateCreated = DateTime.UtcNow,
|
||||||
EK = ek,
|
Name = name,
|
||||||
isActive = bool.Parse(isActive),
|
isActive = bool.Parse(isActive),
|
||||||
WorkGroup = workGroup,
|
WorkGroup = workGroup,
|
||||||
ShortDescription = shortDescription,
|
ShortDescription = shortDescription,
|
||||||
Category = category,
|
Category = category,
|
||||||
//todo: EKDateCreated
|
ResponseArea = responseArea,
|
||||||
EKDateCreated = ConvertDateFromStr(ekDateCreatedStr),
|
Duration = duration,
|
||||||
//EKDateCreated = null,
|
EK = ek,
|
||||||
|
Initiator = initiator,
|
||||||
|
FullDescription = fullDescription,
|
||||||
|
ClosingCode = closingCode,
|
||||||
|
Solution = solution,
|
||||||
Process = process,
|
Process = process,
|
||||||
SubProcess = subProcess,
|
SubProcess = subProcess,
|
||||||
|
TNK = tnk,
|
||||||
|
Work = work,
|
||||||
|
Worker = worker,
|
||||||
Status = "Checking"
|
Status = "Checking"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user