public override void StartBuiness(TransInfoDto transInfo) { // 启动新流程,记录到流程的ID,任务ID等信息 IPersistence p = transInfo.Persistence; SubRoutingBookmark submitRouting = JsonHelper.JsonToT <SubRoutingBookmark>(XmlHelper.GetSafeValue(transInfo.Activity, ActivityConst.DETAILS)); this.TemplateName = submitRouting.TemplateName; this.TemplateId = submitRouting.TemplateId; this.Name = submitRouting.Name; // 生成回归点 NSNodeInfo nsNodeInfo = new NSNodeInfo(); nsNodeInfo.Id = Guid.NewGuid(); nsNodeInfo.TaskId = transInfo.TaskId; nsNodeInfo.InstanceId = transInfo.InstanceId; nsNodeInfo.NodeName = this.Name; nsNodeInfo.ParentId = transInfo.ParentId; nsNodeInfo.RunState = EnumExt.RunStateConst.RUNNING; nsNodeInfo.CreateTime = DateTime.Now; nsNodeInfo.NodeId = Guid.Parse(XmlHelper.GetSafeValue(transInfo.Activity, ActivityConst.ID)); p.CreateActivity(nsNodeInfo); // 生成路由信息 NSRoutingInfo nsRoutingInfo = new NSRoutingInfo(); nsRoutingInfo.Id = Guid.NewGuid(); nsRoutingInfo.InstanceId = transInfo.InstanceId; nsRoutingInfo.ParentId = nsNodeInfo.Id; nsRoutingInfo.TaskId = transInfo.TaskId; nsRoutingInfo.GroupName = ActivityConst.GROUPNAME_INSTANCE; nsRoutingInfo.GroupCounter = 1; p.CreateRoutingInfo(nsRoutingInfo); // 流程实例信息 NSInstanceInfo insanceInfo = new NSInstanceInfo(); insanceInfo.InstanceName = submitRouting.TemplateName; insanceInfo.RunState = EnumExt.RunStateConst.RUNNING; insanceInfo.StartTime = DateTime.Now; insanceInfo.TemplateId = this.TemplateId; insanceInfo.Id = Guid.NewGuid(); insanceInfo.TaskId = transInfo.TaskId; insanceInfo.TemplateName = this.TemplateName; insanceInfo.ParentNodeId = nsNodeInfo.Id; p.CreateInstance(insanceInfo); TransInfoDto copyInfo = transInfo.GetCopyInfo(); copyInfo.InstanceId = insanceInfo.Id; copyInfo.TemplateXml = p.GetTemplateInfo(insanceInfo.TemplateId).TemplateText; // 生成子流程的第一个节点 var startActivities = XmlHelper.GetTemplateFirstActivity(XElement.Parse(copyInfo.TemplateXml)); if (startActivities != null) { new RoutingHost().RoutingFactory(startActivities.ToList(), copyInfo); } base.StartBuiness(transInfo); }