feat(templateMatcher,dal): Первая реализация SyncTemplatesForJobGroup для сгруппированных типов групп регламентных работ.
This commit is contained in:
@@ -48,7 +48,7 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
this.unitFilterService = unitFilterService;
|
||||
}
|
||||
|
||||
public async Task<string> ApplyShortcodesAsync(string str, Guid unitId, Guid jobId)
|
||||
public async Task<string> ApplyShortcodesAsync(string str, Guid unitId, Guid jobId, int? index = null)
|
||||
{
|
||||
logger.LogDebug("Начата подстановка шорткодов. Вход: '{Input}', unitId={UnitId}, jobId={JobId}", str, unitId, jobId);
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
|
||||
// Делаем замену
|
||||
var oldResult = resultName;
|
||||
resultName = ReplaceStandardShortcodes(job, unit, resultName);
|
||||
resultName = ReplaceStandardShortcodes(job, unit, resultName, index);
|
||||
iteration++;
|
||||
|
||||
// Защита от "бесполезных" итераций (строка не изменилась)
|
||||
@@ -262,14 +262,15 @@ namespace PARR.DAL.DomainServices.Implementations
|
||||
}
|
||||
|
||||
|
||||
private static string ReplaceStandardShortcodes(Job job, Unit unit, string input)
|
||||
private static string ReplaceStandardShortcodes(Job job, Unit unit, string input, int? index = null)
|
||||
{
|
||||
return input
|
||||
.Replace("%ЭК%", unit.Name, StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("%ГРУППА_РАБОТ%", job.Group?.GroupName ?? "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("%РАБОТА%", job.WorkName, StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("%ТНК%", job.Tnk?.Name ?? "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("%ТНК-КРАТКО%", job.Tnk?.ShortName ?? "", StringComparison.OrdinalIgnoreCase);
|
||||
.Replace("%ТНК-КРАТКО%", job.Tnk?.ShortName ?? "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("%ИНДЕКС%", index?.ToString() ?? "", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace PARR.DAL.DomainServices.Interfaces
|
||||
{
|
||||
public interface IShortcodesService
|
||||
{
|
||||
Task<string> ApplyShortcodesAsync(string str, Guid unitId, Guid jobId);
|
||||
Task<string> ApplyShortcodesAsync(string str, Guid unitId, Guid jobId, int? index = null);
|
||||
|
||||
bool IsAnyShortcodes(string str);
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
}
|
||||
|
||||
|
||||
public IQueryable<UnitInUnit> Get()
|
||||
{
|
||||
return dataContext.UnitInUnits;
|
||||
}
|
||||
|
||||
|
||||
public Task<List<UnitInUnit>> GetByParentIdAsync(Guid parentId)
|
||||
{
|
||||
@@ -29,6 +34,7 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
public Task<List<UnitInUnit>> GetByChildIdAsync(Guid childId)
|
||||
{
|
||||
return dataContext.UnitInUnits
|
||||
|
||||
@@ -80,5 +80,10 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
.Where(uv => unitIdSet.Contains(uv.UnitId) && fieldIdSet.Contains(uv.FieldId))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public IQueryable<UnitInValue> Get()
|
||||
{
|
||||
return dataContext.UnitInValues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,5 +16,8 @@ namespace PARR.DAL.Services.Interfaces.Unit
|
||||
/// Получает связи, где ParentUnitId unitIds (для IsParent=False).
|
||||
/// </summary>
|
||||
Task<List<UnitInUnit>> GetChildLinksByParentIdsAsync(IEnumerable<Guid> parentUnitIds);
|
||||
|
||||
|
||||
IQueryable<UnitInUnit> Get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace PARR.DAL.Services.Interfaces.Unit
|
||||
/// Получает UnitInValue (с Value) для заданных UnitId и FieldId.
|
||||
/// </summary>
|
||||
Task<List<UnitInValue>> GetByUnitIdsAndFieldIdsAsync(IEnumerable<Guid> unitIds, IEnumerable<Guid> fieldIds);
|
||||
|
||||
IQueryable<UnitInValue> Get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user