diff --git a/common.props b/common.props index c074a72..546cc3b 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 1.0.0-preview.2 + 1.0.0-preview.3 $(NoWarn);CS1591;CS0436 module true diff --git a/src/EasyAbp.ProcessManagement.Domain/EasyAbp/ProcessManagement/Processes/ProcessManager.cs b/src/EasyAbp.ProcessManagement.Domain/EasyAbp/ProcessManagement/Processes/ProcessManager.cs index d00ba62..cb9080f 100644 --- a/src/EasyAbp.ProcessManagement.Domain/EasyAbp/ProcessManagement/Processes/ProcessManager.cs +++ b/src/EasyAbp.ProcessManagement.Domain/EasyAbp/ProcessManagement/Processes/ProcessManager.cs @@ -29,14 +29,17 @@ public virtual Task CreateAsync(CreateProcessModel model, DateTime now) public virtual Task UpdateStateAsync(Process process, IProcessState nextState) { - var processDefinition = Options.GetProcessDefinition(process.ProcessName); + if (nextState.StateName != process.StateName) + { + var processDefinition = Options.GetProcessDefinition(process.ProcessName); - var nextStates = processDefinition.GetChildStateNames(process.StateName); + var nextStates = processDefinition.GetChildStateNames(process.StateName); - if (!nextStates.Contains(nextState.StateName)) - { - throw new AbpException( - $"The specified state `{nextState.StateName}` is invalid for the process `{process.ProcessName}`"); + if (!nextStates.Contains(nextState.StateName)) + { + throw new AbpException( + $"The specified state `{nextState.StateName}` is invalid for the process `{process.ProcessName}`"); + } } process.SetState(nextState);