/// <summary> /// 撤消任务 /// </summary> /// <param name="procInstID">流程实例ID,格式:1_2_3_4</param> /// <param name="activityName">实例结束结点</param> public static void CancelProcInstance(string procInstID) { Mang.WorkflowManagementServer svr = new Mang.WorkflowManagementServer(); try { svr.CreateConnection(); svr.Connection.Open(GetServerConnectionSetup()); string[] procInstIDs = procInstID.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); foreach (string id in procInstIDs) { svr.GotoActivity(Convert.ToInt32(id), "结束"); } } catch { throw; } finally { if (svr != null) { svr.Connection.Close(); } } }
private void GoToActivity() { var fromActivity = GetStringProperty(Constants.SoProperties.ProcessInstance.FromActName); var toActivity = GetStringProperty(Constants.SoProperties.ProcessInstance.ToActName, true); var procInstId = GetIntProperty(Constants.SoProperties.ProcessInstance.ProcInstId, true); using (_mngServer.Connection = ServiceBroker.K2Connection.GetConnection()) { if (string.IsNullOrEmpty(fromActivity)) { _mngServer.GotoActivity(procInstId, toActivity); } else { _mngServer.GotoActivity(procInstId, fromActivity, toActivity); } } }
/// <summary> /// GotoActivity /// </summary> /// <param name="procInstID"></param> /// <param name="activityName"></param> public static void GotoActivity(int procInstID, string activityName) { Mang.WorkflowManagementServer svr = new Mang.WorkflowManagementServer(); try { svr.CreateConnection(); svr.Connection.Open(GetServerConnectionSetup()); svr.GotoActivity(procInstID, activityName); } catch { throw; } finally { if (svr != null) { svr.Connection.Close(); } } }