组装任务管理,所有子任务是一个状态改父级状态

This commit is contained in:
2023-07-27 14:33:28 +08:00
parent 56223cf5d2
commit 47d685738e

View File

@@ -1076,6 +1076,18 @@ namespace Tnb.ProductionMgr
#endregion
prdTaskList.ForEach(x => x.mo_task_status = status);
row = await db.Updateable(prdTaskList).ExecuteCommandAsync();
foreach (var item in prdTaskList)
{
if (string.IsNullOrEmpty(item.parent_id)) continue;
//子任务所有状态相同才修改父任务状态
int count1 = await db.Queryable<PrdMoTask>().CountAsync(y => y.parent_id == item.parent_id);
int count2 = await db.Queryable<PrdMoTask>().CountAsync(y => y.parent_id == item.parent_id && y.mo_task_status==status);
if (count1 == count2)
{
await db.Updateable<PrdMoTask>().SetColumns(x => x.mo_task_status == status)
.Where(x => x.id == item.parent_id).ExecuteCommandAsync();
}
}
if (row > 0)
{
taskReportLogs.AddRange(prdTaskList);