|
|
@ -2140,8 +2140,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
var userId = long.Parse(user.UserId);
|
|
|
|
|
|
|
|
|
|
|
|
DataResult<List<dynamic>> result = new();
|
|
|
|
DataResult<List<dynamic>> result = new();
|
|
|
|
List<long> taskIdList = []; // 查询结果中的任务主键列表
|
|
|
|
|
|
|
|
List<(long taskId, int count)?> childTaskData = []; // 查询结果中任务的子任务列表
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2780,7 +2778,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
.LeftJoin<SeaExport>((t, a, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
.LeftJoin<SeaExport>((t, a, s) => t.OUT_BS_NO == s.Id);
|
|
|
|
|
|
|
|
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, user);
|
|
|
|
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, user);
|
|
|
|
|
|
|
|
|
|
|
|
ISugarQueryable<dynamic> queryableTemp = queryable.Select<dynamic>((t, a, s) => new
|
|
|
|
ISugarQueryable<dynamic> queryableTemp = queryable.Select<dynamic>((t, a, s) => new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
|
PK_ID = t.Id.SelectAll(),
|
|
|
@ -2814,24 +2812,6 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
|
|
|
|
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;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2841,6 +2821,8 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
List<long> taskIdList = result.Data.Select(x => (long)x.Id).ToList(); // 查询结果中的任务主键列表
|
|
|
|
|
|
|
|
|
|
|
|
// 查询任务接收人列表
|
|
|
|
// 查询任务接收人列表
|
|
|
|
var allRecvUserList = await tenantDb.Queryable<TaskBaseAllocation>()
|
|
|
|
var allRecvUserList = await tenantDb.Queryable<TaskBaseAllocation>()
|
|
|
|
.Where(x => taskIdList.Contains(x.TaskId))
|
|
|
|
.Where(x => taskIdList.Contains(x.TaskId))
|
|
|
@ -2854,6 +2836,19 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
RecvUserStatusTime = x.StatusTime
|
|
|
|
RecvUserStatusTime = x.StatusTime
|
|
|
|
}).ToListAsync();
|
|
|
|
}).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)
|
|
|
|
foreach (var item in result.Data)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2915,7 +2910,7 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 4.赋值子任务数量
|
|
|
|
// 4.赋值子任务数量
|
|
|
|
item.ChildTaskCount = childTaskData.FirstOrDefault(x => x.Value.taskId == taskId)?.count ?? 0;
|
|
|
|
item.ChildTaskCount = childTaskTotal.FirstOrDefault(x => x.ParentTaskId == taskId)?.Count ?? 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|