diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 3c57b8fa..39856845 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1106,6 +1106,57 @@ namespace Tnb.ProductionMgr } } #endregion + + foreach (var item in prdTaskList) + { + switch (behavior) + { + // case PrdTaskBehavior.Release: + // if (item.mo_task_status == status) + // { + // throw Oops.Bah("已下发的不能再下发"); + // } + // break; + case PrdTaskBehavior.Start: + if (item.mo_task_status == status) + { + throw Oops.Bah("已开始的不能再开始"); + } + + if (item.mo_task_status!=DictConst.ToBeStartedEnCode || item.mo_task_status!=DictConst.MoStatusPauseCode) + { + throw Oops.Bah("状态错误无法开始"); + } + break; + case PrdTaskBehavior.Pause: + if (item.mo_task_status == status) + { + throw Oops.Bah("已暂停的不能再暂停"); + } + if (item.mo_task_status!=DictConst.InProgressEnCode) + { + throw Oops.Bah("状态错误无法暂停"); + } + break; + case PrdTaskBehavior.Compled: + if (item.mo_task_status == status) + { + throw Oops.Bah("已完成的不能再完成"); + } + if (item.mo_task_status!=DictConst.InProgressEnCode || item.mo_task_status!=DictConst.MoStatusPauseCode) + { + throw Oops.Bah("状态错误无法完成"); + } + break; + case PrdTaskBehavior.Closed: + if (item.mo_task_status == status) + { + throw Oops.Bah("已关闭的不能再关闭"); + } + break; + } + } + prdTaskList.ForEach(x => x.mo_task_status = status); if (behavior == PrdTaskBehavior.Start) {