/// <summary> /// 流程处理页面:显示 /// isNew:true 新建,false 待办 /// </summary> /// <returns></returns> public ActionResult Handle(bool isNew, string id) { RuntimeService runtime = AntApi.Runtime; TaskService tasker = AntApi.Tasker; FormService former = AntApi.Former; RtTask task = null; string step = string.Empty; Guid instanceGuid = new Guid(); if (isNew) { instanceGuid = runtime.NewInstanceByID(new Guid(id), Guid.Empty, null); step = "0008"; task = tasker.GetFirstTaskByInstance(instanceGuid); } else { RtInstance instance = tasker.GetInstanceByTask(new Guid(id)); instanceGuid = instance.InstanceGuid; task = tasker.GetTaskByTaskGuid(new Guid(id)); } ViewBag.FormHtml = former.GetFormByTaskGuid(task.TaskGuid); ViewBag.Step = step; ViewBag.InstanceGuid = instanceGuid; ViewBag.TaskGuid = task.TaskGuid; return(View()); }
public RtTask GetFirstTaskByInstance(Guid InstanceGuid) { RtInstance instance = AntApi.DB.RtInstances.First <RtInstance>(o => o.InstanceGuid == InstanceGuid); RtTask task = AntApi.DB.RtTasks.First <RtTask>(o => o.InstanceGuid == instance.InstanceGuid); return(task); }
public RtInstance GetInstanceByTask(Guid TaskGuid) { RtTask task = AntApi.DB.RtTasks.First <RtTask>(o => o.TaskGuid == TaskGuid); RtInstance instance = AntApi.DB.RtInstances.First <RtInstance>(o => o.InstanceGuid == task.InstanceGuid); return(instance); }
public void Next(Guid InstanceGuid, Guid TaskGuid) { RtInstance instance = AntApi.DB.RtInstances.First(o => o.InstanceGuid == InstanceGuid); RtTask task = AntApi.DB.RtTasks.First(o => o.TaskGuid == TaskGuid); string ActivityID = AntApi.DB.RtActivitys.First(o => o.ActivityGuid == task.ActivityGuid).ActivityID; Stream xml = StreamUtil.StreamFromString(instance.ProcessXml); FlowObjParser fParser = new FlowObjParser(); ZUserTask zUserTask = fParser.FindNode <ZUserTask>(xml, "UserTask", ActivityID); BpmContext context = new BpmContext(); context.InstanceID = InstanceGuid; context.ProcessXml = xml; context.Element = zUserTask; Exchange userTask = zUserTask.Exchange; userTask.Leave(context); }