using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using WiDAL.DTOs; using WiDAL.Query.Wi; namespace WiDAL.CustomCode.WiSkillGap; public class WiSkillGapDAL : IWiSkillGapDAL { private readonly IQueryExecutor _qe; public WiSkillGapDAL(IQueryExecutor qe) => _qe = qe; public async Task> GetWorkCentersForLine(int productionLineId, DateOnly allocationDate, LoginDTO login, CancellationToken ct) { return await _qe.QueryAsync(login, WiSkillGapQB.GET_WORKCENTERS_FOR_LINE, new { ProductionLineId = productionLineId, AllocationDate = allocationDate, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); } public async Task> GetActiveWorkOrdersForWorkCenters( IEnumerable workCenterIds, DateTime allocationDate, LoginDTO login, CancellationToken ct) { var ids = workCenterIds.ToList(); if (ids.Count == 0) return []; return await _qe.QueryAsync(login, WiSkillGapQB.GET_ACTIVE_WORKORDERS_FOR_WORKCENTERS, new { WorkCenterIds = ids, AllocationDate = allocationDate, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); } public async Task GetItemModelGroup(int itemId, LoginDTO login, CancellationToken ct) { return await _qe.QuerySingleAsync(login, WiSkillGapQB.GET_ITEM_MODEL_GROUP, new { ItemId = itemId, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); } public async Task> GetResourceEmployeesForWorkOrder(int indentDetailId, LoginDTO login, CancellationToken ct) { return await _qe.QueryAsync(login, WiSkillGapQB.GET_RESOURCE_EMPLOYEES_FOR_WORKORDER, new { IndentDetailId = indentDetailId }, cancellationToken: ct).ConfigureAwait(false); } public async Task GetEmployeeName(int employeeId, LoginDTO login, CancellationToken ct) { return await _qe.QuerySingleAsync(login, WiSkillGapQB.GET_EMPLOYEE_NAME, new { EmployeeId = employeeId, TenantId = login.ClientId }, cancellationToken: ct).ConfigureAwait(false); } }