complete rollcall history details
This commit is contained in:
@@ -813,7 +813,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
|
||||
if (early != TimeSpan.Zero)
|
||||
{
|
||||
return early*1;
|
||||
return early * 1;
|
||||
}
|
||||
|
||||
return TimeSpan.Zero;
|
||||
@@ -2292,6 +2292,8 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
.Include(x => x.RollCallEmployee)
|
||||
.Where(x => x.RollCallEmployee.WorkshopId == workshopId);
|
||||
|
||||
DateTime startDate;
|
||||
DateTime endDate;
|
||||
//این برای این هست که اگر بر اساس پرسنل جستجو شده بود و در titleId اگر به فرمت YYYY_MM اومد به این معنی هست که باید بر طبق ماه فیلتر بشه نه به صورت روزانه
|
||||
if (searchModel.EmployeeId is > 0)
|
||||
{
|
||||
@@ -2305,21 +2307,32 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
var startDateFa = $"{year:D4}/{month:D2}/01";
|
||||
var endDateFa = startDateFa.FindeEndOfMonth();
|
||||
|
||||
var startDate = startDateFa.ToGeorgianDateTime();
|
||||
var endDate = endDateFa.ToGeorgianDateTime();
|
||||
startDate = startDateFa.ToGeorgianDateTime();
|
||||
endDate = endDateFa.ToGeorgianDateTime();
|
||||
query = query
|
||||
.Where(x => x.RollCallEmployee.EmployeeId == searchModel.EmployeeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: set correct regex.
|
||||
// if (!Regex.IsMatch(titleId, ""))
|
||||
// throw new BadRequestException("شناسه سر تیتر وارد شده نامعتبر است");
|
||||
|
||||
query = query.Where(x => x.StartDate <= endDate && x.EndDate >= startDate
|
||||
&& x.RollCallEmployee.EmployeeId == searchModel.EmployeeId);
|
||||
startDate = titleId.ToGeorgianDateTime();
|
||||
endDate = startDate;
|
||||
}
|
||||
query = query.Where(x => x.StartDate <= endDate && x.EndDate >= startDate);
|
||||
|
||||
var employeeIds =await query.Select(x => x.RollCallEmployee.EmployeeId).ToListAsync();
|
||||
var employeeIds = await query.Select(x => x.RollCallEmployee.EmployeeId).ToListAsync();
|
||||
|
||||
var rollCalls =await _context.RollCalls
|
||||
var rollCalls = await _context.RollCalls
|
||||
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId)
|
||||
&& startDate <= x.ShiftDate && endDate >= x.ShiftDate).ToListAsync();
|
||||
|
||||
var leaves =await _context.LeaveList.Where(x => x.WorkshopId == workshopId
|
||||
var leaves = await _context.LeaveList.Where(x => x.WorkshopId == workshopId
|
||||
&& employeeIds.Contains(x.EmployeeId) &&
|
||||
x.StartLeave >= endDate && x.EndLeave <= startDate).ToListAsync();
|
||||
x.StartLeave >= endDate && x.EndLeave <= startDate)
|
||||
.ToListAsync();
|
||||
var dateRange = (int)(endDate - startDate).TotalDays + 1;
|
||||
|
||||
var dates = Enumerable.Range(0, dateRange).Select(x => startDate.AddDays(x)).ToList();
|
||||
@@ -2327,7 +2340,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
var employees = await _context.Employees.Where(x => employeeIds
|
||||
.Contains(x.id)).ToListAsync();
|
||||
|
||||
var personnelCodes =await _context.PersonnelCodeSet
|
||||
var personnelCodes = await _context.PersonnelCodeSet
|
||||
.Where(x => x.WorkshopId == workshopId
|
||||
&& employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
||||
|
||||
@@ -2372,8 +2385,6 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
|
||||
return res;
|
||||
|
||||
|
||||
}
|
||||
return new PagedResult<RollCallCaseHistoryDetail>();
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class CaseHistoryController:ClientBaseController
|
||||
return await _rollCallApplication.GetCaseHistoryTitles(_workshopId, searchModel);
|
||||
}
|
||||
|
||||
[HttpGet("{titleId}")]
|
||||
[HttpGet("details")]
|
||||
public async Task<ActionResult<PagedResult<RollCallCaseHistoryDetail>>> GetDetails(string titleId, RollCallCaseHistorySearchModel searchModel)
|
||||
{
|
||||
return await _rollCallApplication.GetCaseHistoryDetails(_workshopId, titleId, searchModel);
|
||||
|
||||
Reference in New Issue
Block a user