|
|
|
@ -2140,8 +2140,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
|
|
|
|
|
DataResult<List<dynamic>> result = new();
|
|
|
|
|
List<long> taskIdList = []; // 查询结果中的任务主键列表
|
|
|
|
|
List<(long taskId, int count)?> childTaskData = []; // 查询结果中任务的子任务列表
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -2814,24 +2812,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
#endif
|
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
taskIdList = result.Data.Select(x => (long)x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
// 查询子任务
|
|
|
|
|
var childTaskTotalQueryable = tenantDb.Queryable<TaskBaseInfo>().Where(x => taskIdList.Contains(x.ParentTaskId) && x.IsChild == true)
|
|
|
|
|
.GroupBy(x => new { x.ParentTaskId })
|
|
|
|
|
.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
ParentTaskId = x.ParentTaskId,
|
|
|
|
|
Count = SqlFunc.AggregateCount(x.ParentTaskId)
|
|
|
|
|
});
|
|
|
|
|
#if DEBUG
|
|
|
|
|
var sql1 = childTaskTotalQueryable.ToSqlString();
|
|
|
|
|
#endif
|
|
|
|
|
var childTaskTotal = await childTaskTotalQueryable.ToListAsync();
|
|
|
|
|
childTaskData = childTaskTotal.Select(x => new ValueTuple<long, int>?((x.ParentTaskId, x.Count))).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -2841,6 +2821,8 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
{
|
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
List<long> taskIdList = result.Data.Select(x => (long)x.Id).ToList(); // 查询结果中的任务主键列表
|
|
|
|
|
|
|
|
|
|
// 查询任务接收人列表
|
|
|
|
|
var allRecvUserList = await tenantDb.Queryable<TaskBaseAllocation>()
|
|
|
|
|
.Where(x => taskIdList.Contains(x.TaskId))
|
|
|
|
@ -2854,6 +2836,19 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
RecvUserStatusTime = x.StatusTime
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
// 查询子任务
|
|
|
|
|
var childTaskTotalQueryable = tenantDb.Queryable<TaskBaseInfo>().Where(x => taskIdList.Contains(x.ParentTaskId) && x.IsChild == true)
|
|
|
|
|
.GroupBy(x => new { x.ParentTaskId })
|
|
|
|
|
.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
ParentTaskId = x.ParentTaskId,
|
|
|
|
|
Count = SqlFunc.AggregateCount(x.ParentTaskId)
|
|
|
|
|
});
|
|
|
|
|
#if DEBUG
|
|
|
|
|
var sql1 = childTaskTotalQueryable.ToSqlString();
|
|
|
|
|
#endif
|
|
|
|
|
var childTaskTotal = await childTaskTotalQueryable.ToListAsync();
|
|
|
|
|
|
|
|
|
|
// 一些特殊处理
|
|
|
|
|
foreach (var item in result.Data)
|
|
|
|
|
{
|
|
|
|
@ -2915,7 +2910,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 4.赋值子任务数量
|
|
|
|
|
item.ChildTaskCount = childTaskData.FirstOrDefault(x => x.Value.taskId == taskId)?.count ?? 0;
|
|
|
|
|
item.ChildTaskCount = childTaskTotal.FirstOrDefault(x => x.ParentTaskId == taskId)?.Count ?? 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|