feat(aihit): AIHITLoadWorker + AIHITSyncWorker
This commit is contained in:
42
PARR.AIHITLoader/Services/AIHITService.cs
Normal file
42
PARR.AIHITLoader/Services/AIHITService.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.AIHITLoader.Context;
|
||||
using PARR.AIHITLoader.Models;
|
||||
|
||||
namespace PARR.AIHITLoader.Services
|
||||
{
|
||||
internal class AIHITService : IAIHITService
|
||||
{
|
||||
private readonly AIHITContext context;
|
||||
private readonly ILogger<AIHITService> logger;
|
||||
|
||||
public AIHITService(AIHITContext context, ILogger<AIHITService> logger)
|
||||
{
|
||||
this.context = context;
|
||||
this.logger = logger;
|
||||
}
|
||||
public List<EK>? GetEKList(string respArea)
|
||||
{
|
||||
var parameters = new List<SqlParameter>() { new SqlParameter("@зо", respArea) };
|
||||
|
||||
try
|
||||
{
|
||||
var result = context.Set<EK>().FromSqlRaw($"EXEC mao2.dbo.sp_IPP_PARR_PTK_get_EK @зо", parameters.ToArray()).ToList();
|
||||
|
||||
if (result == null || !result.Any())
|
||||
{
|
||||
logger.LogWarning($"Процедура sp_IPP_PARR_PTK_get_EK вернула пустой список ЭК");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, $"Ошибка при выполнении ХП sp_IPP_PARR_PTK_get_EK({respArea})");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user