When sending project infrastructure sending today's Planned task numbers
This commit is contained in:
parent
d049be9e49
commit
91d7c3b508
@ -15,5 +15,6 @@ namespace Marco.Pms.Model.ViewModels.Projects
|
||||
|
||||
public List<WorkArea>? workAreas { get; set; }
|
||||
public List<WorkItem>? workItems { get; set; }
|
||||
public List<TaskAllocation>? Tasks { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace Marco.Pms.Model.ViewModels.Projects
|
||||
public class WorkItemVM
|
||||
{
|
||||
public Guid WorkItemId { get; set; }
|
||||
public double TodaysAssigned { get; set; }
|
||||
public WorkItem? WorkItem { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Activities;
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
@ -161,17 +162,25 @@ namespace MarcoBMS.Services.Controllers
|
||||
foreach (WorkItem workItemDto in vm.workItems.Where(c => c.WorkAreaId == workAreaDto.Id).ToList())
|
||||
{
|
||||
WorkItemVM workItemVM = new WorkItemVM() { WorkItemId = workItemDto.Id, WorkItem = workItemDto };
|
||||
//workItemVM.WorkItem.WorkArea = null
|
||||
|
||||
workItemVM.WorkItem.WorkArea = new WorkArea();
|
||||
//workItemVM.WorkItem.ActivityMaster.Tenant = null;
|
||||
|
||||
if (workItemVM.WorkItem.ActivityMaster != null)
|
||||
{
|
||||
workItemVM.WorkItem.ActivityMaster.Tenant = new Tenant();
|
||||
}
|
||||
//workItemVM.WorkItem.Tenant = null;
|
||||
workItemVM.WorkItem.Tenant = new Tenant();
|
||||
|
||||
|
||||
double todaysAssigned = 0;
|
||||
if (vm.Tasks != null)
|
||||
{
|
||||
var tasks = vm.Tasks.Where(t => t.WorkItemId == workItemDto.Id).ToList();
|
||||
foreach (TaskAllocation task in tasks)
|
||||
{
|
||||
todaysAssigned += task.PlannedTask;
|
||||
}
|
||||
}
|
||||
workItemVM.TodaysAssigned = todaysAssigned;
|
||||
|
||||
workAreaVM.WorkItems.Add(workItemVM);
|
||||
}
|
||||
@ -210,13 +219,14 @@ namespace MarcoBMS.Services.Controllers
|
||||
idList = workAreas.Select(o => o.Id).ToList();
|
||||
List<WorkItem> workItems = await _context.WorkItems.Include(c => c.WorkCategoryMaster).Where(c => idList.Contains(c.WorkAreaId)).Include(c => c.ActivityMaster).ToListAsync();
|
||||
// List <WorkItem> workItems = _unitOfWork.WorkItem.GetAll(c => idList.Contains(c.WorkAreaId), includeProperties: "ActivityMaster").ToList();
|
||||
|
||||
idList = workItems.Select(t => t.Id).ToList();
|
||||
List<TaskAllocation> tasks = await _context.TaskAllocations.Where(t => idList.Contains(t.WorkItemId) && t.AssignmentDate.Date == DateTime.UtcNow.Date).ToListAsync();
|
||||
vm.project = project;
|
||||
vm.buildings = buildings;
|
||||
vm.floors = floors;
|
||||
vm.workAreas = workAreas;
|
||||
vm.workItems = workItems;
|
||||
|
||||
vm.Tasks = tasks;
|
||||
return vm;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user