diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index d4e57270..165b087b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -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().CountAsync(y => y.parent_id == item.parent_id); + int count2 = await db.Queryable().CountAsync(y => y.parent_id == item.parent_id && y.mo_task_status==status); + if (count1 == count2) + { + await db.Updateable().SetColumns(x => x.mo_task_status == status) + .Where(x => x.id == item.parent_id).ExecuteCommandAsync(); + } + } if (row > 0) { taskReportLogs.AddRange(prdTaskList);