feat(esppScheduleSync): доделал метод ParseStrToEsppObject
This commit is contained in:
@@ -294,7 +294,7 @@ namespace PARR.DAL.Context
|
||||
{
|
||||
f.HasData(
|
||||
new { Id = (int)EsppSchTypeScheduleEnum.Regularly, Name = EsppSchTypeScheduleEnum.Regularly.ToString(), Description = "Регулярно" },
|
||||
new { Id = (int)EsppSchTypeScheduleEnum.Weekly, Name = EsppSchTypeScheduleEnum.Weekly.ToString(), Description = "Еженежельно" },
|
||||
new { Id = (int)EsppSchTypeScheduleEnum.Weekly, Name = EsppSchTypeScheduleEnum.Weekly.ToString(), Description = "Еженедельно" },
|
||||
new { Id = (int)EsppSchTypeScheduleEnum.Monthly, Name = EsppSchTypeScheduleEnum.Monthly.ToString(), Description = "Ежемесячно" },
|
||||
new { Id = (int)EsppSchTypeScheduleEnum.Monthly2, Name = EsppSchTypeScheduleEnum.Monthly2.ToString(), Description = "Ежемесячно-2" },
|
||||
new { Id = (int)EsppSchTypeScheduleEnum.Annually, Name = EsppSchTypeScheduleEnum.Annually.ToString(), Description = "Ежегодно" },
|
||||
|
||||
2667
PARR.DAL/Migrations/20231126232527_TblEsppSchTypeScheduleFixDescription.Designer.cs
generated
Normal file
2667
PARR.DAL/Migrations/20231126232527_TblEsppSchTypeScheduleFixDescription.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PARR.DAL.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TblEsppSchTypeScheduleFixDescription : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EsppSchTypeSchedules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Description",
|
||||
value: "Еженедельно");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EsppSchTypeSchedules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Description",
|
||||
value: "Еженежельно");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -859,7 +859,7 @@ namespace PARR.DAL.Migrations
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
Description = "Еженежельно",
|
||||
Description = "Еженедельно",
|
||||
Name = "Weekly"
|
||||
},
|
||||
new
|
||||
|
||||
@@ -99,6 +99,10 @@ namespace PARR.EsppScheduleSync
|
||||
|
||||
bool.TryParse(splittedContent[1].Trim(), out var isActive);
|
||||
|
||||
var typeSchedule = GetTypeScheduleByString(splittedContent[7]);
|
||||
if (!typeSchedule.HasValue)
|
||||
return null;
|
||||
|
||||
var esppObject = new EsppObjectSchedule
|
||||
{
|
||||
TemplateName = templateName,
|
||||
@@ -107,8 +111,7 @@ namespace PARR.EsppScheduleSync
|
||||
IsActive = isActive,
|
||||
ResponseArea = splittedContent[5],
|
||||
WorkGroup = splittedContent[3],
|
||||
//TODO:!!!
|
||||
//TypeSchedule = splittedContent[7],
|
||||
TypeSchedule = typeSchedule.Value,
|
||||
Interval = splittedContent[8],
|
||||
Dayofweek = splittedContent[15],
|
||||
Dayofmonth = splittedContent[14],
|
||||
@@ -131,6 +134,40 @@ namespace PARR.EsppScheduleSync
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Преобразовать из строки в Тип Повторения
|
||||
/// </summary>
|
||||
/// <param name="typeSchedule"></param>
|
||||
/// <returns></returns>
|
||||
private EsppSchTypeScheduleEnum? GetTypeScheduleByString(string typeSchedule)
|
||||
{
|
||||
typeSchedule = typeSchedule.ToLower();
|
||||
|
||||
//Regularly, Регулярно (значение в ЕСПП и в БД не совпадают, в бд Regularly, в ЕСПП simple)
|
||||
if (typeSchedule == "simple" || typeSchedule == EsppSchTypeScheduleEnum.Regularly.ToString().ToLower())
|
||||
return EsppSchTypeScheduleEnum.Regularly;
|
||||
|
||||
if (typeSchedule == EsppSchTypeScheduleEnum.Weekly.ToString().ToLower())
|
||||
return EsppSchTypeScheduleEnum.Weekly;
|
||||
|
||||
if (typeSchedule == EsppSchTypeScheduleEnum.Monthly.ToString().ToLower())
|
||||
return EsppSchTypeScheduleEnum.Monthly;
|
||||
|
||||
if (typeSchedule == EsppSchTypeScheduleEnum.Monthly2.ToString().ToLower())
|
||||
return EsppSchTypeScheduleEnum.Monthly2;
|
||||
|
||||
if (typeSchedule == EsppSchTypeScheduleEnum.Annually.ToString().ToLower())
|
||||
return EsppSchTypeScheduleEnum.Annually;
|
||||
|
||||
if (typeSchedule == EsppSchTypeScheduleEnum.Annually2.ToString().ToLower())
|
||||
return EsppSchTypeScheduleEnum.Annually2;
|
||||
|
||||
logger.LogError($"Не смог преобразовать Тип повторения из ЕСПП в EsppSchTypeScheduleEnum. Получено значение {typeSchedule}");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Проверка имени шаблона и расписание на соответствие префиксу из настроек
|
||||
/// </summary>
|
||||
@@ -166,98 +203,81 @@ namespace PARR.EsppScheduleSync
|
||||
// т.е. если стояло Ежедненвно:понедельник, а изменили например на Еженедельно..., то в ежедневно значения останутся, но будут отрабатывать значения из Еженедельно.
|
||||
// Т е значения из Ежедненвно проверять не нужно, вот их и будем очищать
|
||||
|
||||
//TODO: сделать миграцию в БД: Еженежельно
|
||||
|
||||
//TODO:!!!
|
||||
////Regularly, Регулярно (значение в ЕСПП и в БД не совпадают, в бд Regularly, в ЕСПП simple)
|
||||
//if (esppObject.TypeSchedule.ToLower() == "simple" || esppObject.TypeSchedule.ToLower() == EsppSchTypeScheduleEnum.Regularly.ToString().ToLower())
|
||||
//{
|
||||
// //esppObject.Interval = string.Empty;
|
||||
switch (esppObject.TypeSchedule)
|
||||
{
|
||||
case EsppSchTypeScheduleEnum.Regularly:
|
||||
//esppObject.Interval = string.Empty;
|
||||
esppObject.Dayofweek = string.Empty;
|
||||
esppObject.Dayofmonth = string.Empty;
|
||||
esppObject.Md1 = string.Empty;
|
||||
esppObject.Md2 = string.Empty;
|
||||
esppObject.Annualm = string.Empty;
|
||||
esppObject.Annualday = string.Empty;
|
||||
esppObject.An1 = string.Empty;
|
||||
esppObject.An2 = string.Empty;
|
||||
esppObject.An3 = string.Empty;
|
||||
break;
|
||||
case EsppSchTypeScheduleEnum.Weekly:
|
||||
esppObject.Interval = string.Empty;
|
||||
//esppObject.Dayofweek = string.Empty;
|
||||
esppObject.Dayofmonth = string.Empty;
|
||||
esppObject.Md1 = string.Empty;
|
||||
esppObject.Md2 = string.Empty;
|
||||
esppObject.Annualm = string.Empty;
|
||||
esppObject.Annualday = string.Empty;
|
||||
esppObject.An1 = string.Empty;
|
||||
esppObject.An2 = string.Empty;
|
||||
esppObject.An3 = string.Empty;
|
||||
break;
|
||||
case EsppSchTypeScheduleEnum.Monthly:
|
||||
esppObject.Interval = string.Empty;
|
||||
esppObject.Dayofweek = string.Empty;
|
||||
//esppObject.Dayofmonth = string.Empty;
|
||||
esppObject.Md1 = string.Empty;
|
||||
esppObject.Md2 = string.Empty;
|
||||
esppObject.Annualm = string.Empty;
|
||||
esppObject.Annualday = string.Empty;
|
||||
esppObject.An1 = string.Empty;
|
||||
esppObject.An2 = string.Empty;
|
||||
esppObject.An3 = string.Empty;
|
||||
break;
|
||||
case EsppSchTypeScheduleEnum.Monthly2:
|
||||
esppObject.Interval = string.Empty;
|
||||
esppObject.Dayofweek = string.Empty;
|
||||
esppObject.Dayofmonth = string.Empty;
|
||||
//esppObject.Md1 = string.Empty;
|
||||
//esppObject.Md2 = string.Empty;
|
||||
esppObject.Annualm = string.Empty;
|
||||
esppObject.Annualday = string.Empty;
|
||||
esppObject.An1 = string.Empty;
|
||||
esppObject.An2 = string.Empty;
|
||||
esppObject.An3 = string.Empty;
|
||||
break;
|
||||
case EsppSchTypeScheduleEnum.Annually:
|
||||
esppObject.Interval = string.Empty;
|
||||
esppObject.Dayofweek = string.Empty;
|
||||
esppObject.Dayofmonth = string.Empty;
|
||||
esppObject.Md1 = string.Empty;
|
||||
esppObject.Md2 = string.Empty;
|
||||
//esppObject.Annualm = string.Empty;
|
||||
//esppObject.Annualday = string.Empty;
|
||||
esppObject.An1 = string.Empty;
|
||||
esppObject.An2 = string.Empty;
|
||||
esppObject.An3 = string.Empty;
|
||||
break;
|
||||
case EsppSchTypeScheduleEnum.Annually2:
|
||||
esppObject.Interval = string.Empty;
|
||||
esppObject.Dayofweek = string.Empty;
|
||||
esppObject.Dayofmonth = string.Empty;
|
||||
esppObject.Md1 = string.Empty;
|
||||
esppObject.Md2 = string.Empty;
|
||||
esppObject.Annualm = string.Empty;
|
||||
esppObject.Annualday = string.Empty;
|
||||
//esppObject.An1 = string.Empty;
|
||||
//esppObject.An2 = string.Empty;
|
||||
//esppObject.An3 = string.Empty;
|
||||
//}
|
||||
|
||||
////Weekly, Еженедельно
|
||||
//if (esppObject.TypeSchedule == "weekly")
|
||||
//{
|
||||
// esppObject.Interval = string.Empty;
|
||||
// //esppObject.Dayofweek = string.Empty;
|
||||
// esppObject.Dayofmonth = string.Empty;
|
||||
// esppObject.Md1 = string.Empty;
|
||||
// esppObject.Md2 = string.Empty;
|
||||
// esppObject.Annualm = string.Empty;
|
||||
// esppObject.Annualday = string.Empty;
|
||||
// esppObject.An1 = string.Empty;
|
||||
// esppObject.An2 = string.Empty;
|
||||
// esppObject.An3 = string.Empty;
|
||||
//}
|
||||
|
||||
////Monthly, Ежемесячно
|
||||
//if (esppObject.TypeSchedule == "monthly")
|
||||
//{
|
||||
// esppObject.Interval = string.Empty;
|
||||
// esppObject.Dayofweek = string.Empty;
|
||||
// //esppObject.Dayofmonth = string.Empty;
|
||||
// esppObject.Md1 = string.Empty;
|
||||
// esppObject.Md2 = string.Empty;
|
||||
// esppObject.Annualm = string.Empty;
|
||||
// esppObject.Annualday = string.Empty;
|
||||
// esppObject.An1 = string.Empty;
|
||||
// esppObject.An2 = string.Empty;
|
||||
// esppObject.An3 = string.Empty;
|
||||
//}
|
||||
|
||||
////Monthly2, Ежемесячно-2
|
||||
//if (esppObject.TypeSchedule == "monthly2")
|
||||
//{
|
||||
// esppObject.Interval = string.Empty;
|
||||
// esppObject.Dayofweek = string.Empty;
|
||||
// esppObject.Dayofmonth = string.Empty;
|
||||
// //esppObject.Md1 = string.Empty;
|
||||
// //esppObject.Md2 = string.Empty;
|
||||
// esppObject.Annualm = string.Empty;
|
||||
// esppObject.Annualday = string.Empty;
|
||||
// esppObject.An1 = string.Empty;
|
||||
// esppObject.An2 = string.Empty;
|
||||
// esppObject.An3 = string.Empty;
|
||||
//}
|
||||
|
||||
////Annually, Ежегодно
|
||||
//if (esppObject.TypeSchedule == "annually")
|
||||
//{
|
||||
// esppObject.Interval = string.Empty;
|
||||
// esppObject.Dayofweek = string.Empty;
|
||||
// esppObject.Dayofmonth = string.Empty;
|
||||
// esppObject.Md1 = string.Empty;
|
||||
// esppObject.Md2 = string.Empty;
|
||||
// //esppObject.Annualm = string.Empty;
|
||||
// //esppObject.Annualday = string.Empty;
|
||||
// esppObject.An1 = string.Empty;
|
||||
// esppObject.An2 = string.Empty;
|
||||
// esppObject.An3 = string.Empty;
|
||||
//}
|
||||
|
||||
////Annually2, Ежегодно-2
|
||||
//if (esppObject.TypeSchedule == "annually2")
|
||||
//{
|
||||
// esppObject.Interval = string.Empty;
|
||||
// esppObject.Dayofweek = string.Empty;
|
||||
// esppObject.Dayofmonth = string.Empty;
|
||||
// esppObject.Md1 = string.Empty;
|
||||
// esppObject.Md2 = string.Empty;
|
||||
// esppObject.Annualm = string.Empty;
|
||||
// esppObject.Annualday = string.Empty;
|
||||
// //esppObject.An1 = string.Empty;
|
||||
// //esppObject.An2 = string.Empty;
|
||||
// //esppObject.An3 = string.Empty;
|
||||
//}
|
||||
break;
|
||||
}
|
||||
|
||||
return esppObject;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<None Include="docker-compose.aihit-syncher.yml" />
|
||||
<None Include="docker-compose.espp-order-loader.yml" />
|
||||
<None Include="docker-compose.espp-order-manager.yml" />
|
||||
<None Include="docker-compose.espp-schedule-sync.yml" />
|
||||
<None Include="docker-compose.espp-template-sync.yml" />
|
||||
<None Include="docker-compose.generator-templates.yml" />
|
||||
<None Include="docker-compose.master.yml" />
|
||||
|
||||
Reference in New Issue
Block a user