/// <summary> /// 召回流程 /// </summary> public void ReCall(RecallFlowInstanceReq request) { var user = _auth.GetCurrentUser().User; FlowInstance flowInstance = Get(request.FlowInstanceId); if (flowInstance.IsFinish == FlowInstanceStatus.Draft || flowInstance.IsFinish == FlowInstanceStatus.Finished) { throw new Exception("当前流程状态不能召回"); } FlowRuntime wfruntime = new FlowRuntime(flowInstance); string startNodeId = wfruntime.startNodeId; //起始节点 wfruntime.ReCall(); flowInstance.IsFinish = FlowInstanceStatus.Draft; flowInstance.PreviousId = flowInstance.ActivityId; flowInstance.ActivityId = startNodeId; flowInstance.ActivityType = wfruntime.GetNodeType(startNodeId); flowInstance.ActivityName = wfruntime.Nodes[startNodeId].name; flowInstance.MakerList = GetNodeMarkers(wfruntime.Nodes[startNodeId], flowInstance.CreateUserId); AddTransHistory(wfruntime); UnitWork.Update(flowInstance); UnitWork.Add(new FlowInstanceOperationHistory { InstanceId = request.FlowInstanceId, CreateUserId = user.Id, CreateUserName = user.Name, CreateDate = DateTime.Now, Content = $"【撤销】由{user.Name}撤销,备注:{request.Description}" }); UnitWork.Save(); }