feat(master): обновлена логика статусов нарядов, присвояения значений журнала агента.
This commit is contained in:
@@ -53,7 +53,7 @@ namespace PARR.EsppOrderLoader.Services
|
||||
StatusCode = (int)orderStatusService.GetOrderStatusByName(esppOrder.Status),
|
||||
GenerateDate = template == null ?
|
||||
null
|
||||
: CalcGenerationDate(esppOrder.ExpirationDateUTC, template.ApplicationsInWork!.TemplateDuration)
|
||||
: CalcGenerationDate(esppOrder.ExpirationDateUTC, template.ApplicationsInWork!.TemplateDurationTimeSpan)
|
||||
};
|
||||
|
||||
if (!await orderService.CreateAsync(newOrder) || !await orderService.CommitAsync())
|
||||
@@ -63,23 +63,29 @@ namespace PARR.EsppOrderLoader.Services
|
||||
}
|
||||
|
||||
|
||||
private DateTimeOffset? CalcGenerationDate(DateTimeOffset expirationDateUTC, string templateDuration)
|
||||
private DateTimeOffset? CalcGenerationDate(DateTimeOffset expirationDateUTC, TimeSpan? templateDuration)
|
||||
{
|
||||
TimeSpan duration;
|
||||
//TimeSpan duration;
|
||||
|
||||
try
|
||||
//try
|
||||
//{
|
||||
// //ЕСПП кривоногие, они почему-то таймспан пишут так "7 00:00:00", а правильно так: "7:00:00:00"
|
||||
// var durationWithTimeSpanFormat = templateDuration.Replace(" ", ":");
|
||||
// duration = TimeSpan.Parse(durationWithTimeSpanFormat);
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// logger.LogError(e, $"Ошибка при конвертации templateDuration в TimeSpan, исходное значение: {templateDuration}");
|
||||
// return null;
|
||||
//}
|
||||
|
||||
if (templateDuration.HasValue)
|
||||
return expirationDateUTC.Add(-templateDuration.Value);
|
||||
else
|
||||
{
|
||||
//ЕСПП кривоногие, они почему-то таймспан пишут так "7 00:00:00", а правильно так: "7:00:00:00"
|
||||
var durationWithTimeSpanFormat = templateDuration.Replace(" ", ":");
|
||||
duration = TimeSpan.Parse(durationWithTimeSpanFormat);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.LogError(e, $"Ошибка при конвертации templateDuration в TimeSpan, исходное значение: {templateDuration}");
|
||||
logger.LogError($"templateDuration = null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return expirationDateUTC.Add(-duration);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user