Exemple #1
0
        public override void StartBuiness(Dtos.TransInfoDto transInfoDto)
        {
            if (transInfoDto.Activity == null)
            {
                throw new Exception("并发结束节点解析有误!");
            }

            var groupName = XmlHelper.GetSafeValue(transInfoDto.Activity, ActivityConst.GROUPNAME);

            // 生成记录节点
            var routingInfo        = transInfoDto.Persistence.CreateParallelRoutingInfo(transInfoDto.TaskId, transInfoDto.InstanceId, groupName);
            var startParalle       = XmlHelper.GetAllActivitiesByType(XElement.Parse(transInfoDto.TemplateXml), EnumExt.ActivityTypeEnum.Process).First(p => XmlHelper.GetSafeValue(p, ActivityConst.GROUPNAME) == groupName);
            var nextActivityCounts = XmlHelper.GetAllNextActivities(transInfoDto.TemplateXml, Guid.Parse(XmlHelper.GetSafeValue(startParalle, ActivityConst.ID)));

            if (nextActivityCounts != null)
            {
                if (routingInfo.GroupCounter == nextActivityCounts.Count())
                {
                    var copyInfo = transInfoDto.GetCopyInfo();
                    copyInfo.GroupName  = groupName;
                    routingInfo.Finshed = true;
                    End(copyInfo);
                }
            }

            base.StartBuiness(transInfoDto);
        }
Exemple #2
0
        public override void EndBuiness(Dtos.TransInfoDto transInfoDto)
        {
            var newAcivities = XmlHelper.GetAllNextActivities(transInfoDto.TemplateXml, Guid.Parse(XmlHelper.GetSafeValue(transInfoDto.Activity, ActivityConst.ID)));

            if (newAcivities != null)
            {
                new RoutingHost().RoutingFactory(newAcivities.ToList(), transInfoDto);
            }
            base.EndBuiness(transInfoDto);
        }
Exemple #3
0
        public override void EndBuiness(Dtos.TransInfoDto transInfoDto)
        {
            var newAcivities = XmlHelper.GetAllNextActivities(transInfoDto.TemplateXml, transInfoDto.InstanceNodeId);

            if (newAcivities != null)
            {
                new RoutingHost().RoutingFactory(newAcivities.ToList(), transInfoDto);
            }
            base.EndBuiness(transInfoDto);
        }
Exemple #4
0
        public override void StartBuiness(Dtos.TransInfoDto transInfoDto)
        {
            var allParents = XmlHelper.GetAllForwardActivities(transInfoDto.TemplateXml, transInfoDto.InstanceNodeId);
            // 生成记录节点
            var routingInfo = transInfoDto.Persistence.CreateParallelRoutingInfo(transInfoDto.TaskId, transInfoDto.InstanceId, _groupStart + this.GroupName);

            if (routingInfo.GroupCounter == allParents.Count())
            {
                var copyInfo = transInfoDto.GetCopyInfo();
                copyInfo.GroupName  = _groupStart + copyInfo.GroupName;
                routingInfo.Finshed = true;

                End(copyInfo);
            }

            base.StartBuiness(transInfoDto);
        }
        public override void StartBuiness(Dtos.TransInfoDto transInfoDto)
        {
            var conditionResult = string.Empty;

            // 判断条件
            if (!string.IsNullOrEmpty(transInfoDto.Condition))
            {
                conditionResult = transInfoDto.Condition;
            }
            else
            {
                return;
            }

            var newAcivities = XmlHelper.GetNextActivityByCondition(transInfoDto.TemplateXml, Guid.Parse(XmlHelper.GetSafeValue(transInfoDto.Activity, ActivityConst.ID)), conditionResult);

            if (newAcivities != null)
            {
                new RoutingHost().RoutingFactory(newAcivities.ToList(), transInfoDto);
            }
            base.StartBuiness(transInfoDto);
        }
Exemple #6
0
        public override void EndBuiness(Dtos.TransInfoDto transInfoDto)
        {
            var copyDto = transInfoDto.GetCopyInfo();

            // 将当前的流程节点设置成end状态
            var currentActivity = copyDto.Persistence.GetActivity(transInfoDto.TaskId, copyDto.InstanceId, copyDto.InstanceNodeId);

            if (currentActivity != null)
            {
                copyDto.Persistence.FinishActivity(currentActivity);
            }

            var nextActivities = XmlHelper.GetAllNextActivities(copyDto.TemplateXml, copyDto.InstanceNodeId);

            // 启动新流程,记录到流程的ID,任务ID等信息
            if (nextActivities != null)
            {
                copyDto.NextActivities = nextActivities.ToList();
            }


            base.EndBuiness(copyDto);
        }
Exemple #7
0
        public override void StartBuiness(Dtos.TransInfoDto transInfoDto)
        {
            // 初始化

            var activityInfo = JsonHelper.JsonToT <StandBookmark>(XmlHelper.GetSafeValue(transInfoDto.Activity, ActivityConst.DETAILS));

            this.NodeID         = activityInfo.NodeID;
            this.NodeDes        = activityInfo.NodeDes;
            this.GroupName      = activityInfo.GroupName;
            this.CanPersistence = activityInfo.CanPersistence;
            this.TransUserNo    = activityInfo.TransUserNo;
            this.SubmitOptions  = activityInfo.SubmitOptions;
            this.Name           = activityInfo.Name;


            // 生成新节点
            NSNodeInfo newActivity = new NSNodeInfo();

            newActivity.Id            = Guid.NewGuid();
            newActivity.NodeName      = activityInfo.Name;
            newActivity.NodeId        = this.NodeID.Value;
            newActivity.InstanceId    = transInfoDto.InstanceId;
            newActivity.ParentId      = transInfoDto.ParentId;
            newActivity.RunState      = EnumExt.RunStateConst.RUNNING;
            newActivity.SubmitOptions = SubmitOptions;
            newActivity.TaskId        = transInfoDto.TaskId;
            newActivity.TransUserNo   = TransUserNo;
            newActivity.CreateTime    = DateTime.Now;
            newActivity.GroupName     = GroupName;
            newActivity.NodeDes       = NodeDes;

            // 保存节点
            transInfoDto.Persistence.CreateActivity(newActivity);

            // 调用其他附属信息
            base.StartBuiness(transInfoDto);
        }
        public override void StartBuiness(Dtos.TransInfoDto transInfo)
        {
            // 启动新流程,记录到流程的ID,任务ID等信息
            IPersistence        p             = transInfo.Persistence;
            SubRoutingsBookmark submitRouting = JsonHelper.JsonToT <SubRoutingsBookmark>(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.ParentId     = nsNodeInfo.Id;
            nsRoutingInfo.InstanceId   = Guid.NewGuid();
            nsRoutingInfo.TaskId       = transInfo.TaskId;
            nsRoutingInfo.GroupName    = ActivityConst.GROUPNAME_INSTANCE;
            nsRoutingInfo.GroupCounter = transInfo.GroupCounter;

            p.CreateRoutingInfo(nsRoutingInfo);

            for (int i = 0; i < transInfo.GroupCounter; i++)
            {
                // 流程实例信息
                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);
        }