计算排班时长

This commit is contained in:
chenlin 2026-01-30 10:42:27 +08:00
parent 8b0f54b379
commit 195db55209

View File

@ -97,11 +97,15 @@ namespace DOAN.Service.Business
public PagedInfo<GroupScheduleDto> ListGroupByDate(GroupScheduleQueryDto2 query)
{
query.ScheduleDate = query.ScheduleDate.Date;
return Queryable().LeftJoin<GroupShift>((it, sh) => it.FkShift == sh.Id).Where((it, sh) => it.ScheduleDate == query.ScheduleDate)
var result= Queryable().LeftJoin<GroupShift>((it, sh) => it.FkShift == sh.Id).Where((it, sh) => it.ScheduleDate == query.ScheduleDate)
.Select((it, sh) => new GroupScheduleDto { ShiftName = sh.Name }, true)
.ToPage<GroupScheduleDto, GroupScheduleDto>(query);
result.Result.ForEach(t =>
{
t.WorkHours = Math.Round((decimal)(((t.EndTime.Value - t.StartTime.Value).TotalMinutes - t.PlanRestTime) / 60.0), 2);
});
return result;
}
/// <summary>