workflow - rollcallEdit - grouping...

This commit is contained in:
SamSys
2024-12-24 21:59:16 +03:30
parent 79a38c31a8
commit 166ccadfba
33 changed files with 1095 additions and 482 deletions

View File

@@ -3,6 +3,7 @@ using CompanyManagment.EFCore;
using Microsoft.EntityFrameworkCore;
using Query.AdminReports.Models;
using System.Data;
using _0_Framework.Application;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace Query.AdminReports.Handlers
@@ -28,8 +29,7 @@ namespace Query.AdminReports.Handlers
//workshop filter by parameters
var rollCallServiceQuery = _companyContext.RollCallServices
.Where(x => x.StartService <= DateTime.Now && x.EndService >= DateTime.Now);
var rollCallServiceQuery = _companyContext.RollCallServices.AsSplitQuery();
var allWorkshops = _companyContext.Workshops.Select(x => new { x.id, x.WorkshopFullName });
if (!string.IsNullOrWhiteSpace(parameters.WorkshopName))
@@ -42,8 +42,12 @@ namespace Query.AdminReports.Handlers
{
WorkshopId = workshop.id,
RollCallServiceType = rcs.ServiceType,
WorkshopName = workshop.WorkshopFullName
});
WorkshopName = workshop.WorkshopFullName,
MaxPersonValid = rcs.MaxPersonValid,
IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now,
ServiceStartFa=rcs.StartService.ToFarsi(),
ServiceEndFa=rcs.EndService.ToFarsi()
});
//workshop population
@@ -77,14 +81,18 @@ namespace Query.AdminReports.Handlers
var workshopsWithServiceList = workshopsWithService.ToList();
return workshopsWithServiceList.Select(x => new WorkshopWithRollCallServiceQueryModel()
{
IsActive = x.IsActive,
ServiceStartFa = x.ServiceStartFa,
ServiceEndFa = x.ServiceEndFa,
WorkshopId = x.WorkshopId,
RollCallServiceType = x.RollCallServiceType,
MaxPersonValid = x.MaxPersonValid,
WorkshopName = x.WorkshopName,
ActiveEmployeesCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId),
ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId &&
lastWeekRollCalls.Contains(y.EmployeeId) && !leavesList.Contains(y.EmployeeId)),
TotalEmployeesCount = workshopsWorkingEmployeesList.FirstOrDefault(y => y.WorkshopId == x.WorkshopId).TotalWorkingEmployeesCount
}).ToList();
}).OrderByDescending(x=>x.IsActive).ToList();
}
}

View File

@@ -20,5 +20,10 @@
return ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100;
}
}
public int MaxPersonValid { get; set; }
public bool IsActive { get; set; }
public string ServiceStartFa { get; set; }
public string ServiceEndFa { get; set; }
}
}