Example #1
0
        /// <summary>
        /// 处理业务数据
        /// </summary>
        public void DisposeBusinessData(int OperatorType, string UserLonginID = null)
        {
            #region


            B_TargetPlan ReportModelA = B_TargetplanOperator.Instance.GetTargetplan(BusinessID.ToGuid());
            if (ReportModelA.WFStatus == "Draft")
            {
                ReportModelA.CreateTime = DateTime.Now;
            }
            var p = BPF.Workflow.Client.WFClientSDK.GetProcess(null, ReportModelA.ID.ToString(), UserLonginID);
            List <NavigatActivity1> listna = new List <NavigatActivity1>();
            NavigatActivity1        na1    = null;
            Dictionary <string, BPF.Workflow.Object.Node> list = new Dictionary <string, BPF.Workflow.Object.Node>();
            string strNextNodeID = p.ProcessInstance.StartNodeID;

            if (p.NodeInstanceList != null)
            {
                foreach (var p1 in p.NodeInstanceList)
                {
                    if (!string.IsNullOrEmpty(strNextNodeID))
                    {
                        var CurrentNode = p.NodeInstanceList[strNextNodeID];
                        list.Add(strNextNodeID, CurrentNode);
                        strNextNodeID = CurrentNode.NextNodeID;
                    }
                }

                foreach (var p1 in list)
                {
                    if (string.IsNullOrEmpty(p1.Value.ParentNodeID))
                    {
                        na1               = new NavigatActivity1();
                        na1.ActivityID    = p1.Value.NodeID;
                        na1.ActivityName  = p1.Value.NodeName;
                        na1.ActivityType  = p1.Value.NodeType;
                        na1.RunningStatus = (p1.Value.Status > 1 ? 3 : p1.Value.Status);
                        List <ClientOpinion1> listclientOp = new List <ClientOpinion1>();
                        listclientOp.Add(new ClientOpinion1()
                        {
                            CreateDate = p1.Value.FinishDateTime
                        });
                        na1.Opinions = listclientOp;

                        List <NavigatCandidate1> listnc = new List <NavigatCandidate1>();

                        var lstNode = p.NodeInstanceList.Where(s => s.Value.ParentNodeID == p1.Value.NodeID);
                        if (lstNode.Count() > 0)
                        {
                            foreach (var itme in lstNode)
                            {
                                listnc.Add(new NavigatCandidate1()
                                {
                                    Id        = itme.Value.User.UserID,
                                    Name      = itme.Value.User.UserName,
                                    Title     = itme.Value.User.UserJobName,
                                    DeptName  = itme.Value.User.UserOrgPathName,
                                    Completed = itme.Value.Status == 2 ? true : false
                                });
                            }
                        }
                        else
                        {
                            listnc.Add(new NavigatCandidate1()
                            {
                                Id        = p1.Value.User.UserID,
                                Name      = p1.Value.User.UserName,
                                Title     = p1.Value.User.UserJobName,
                                DeptName  = p1.Value.User.UserOrgPathName,
                                Completed = p1.Value.Status == 2 ? true : false
                            });
                        }
                        na1.Candidates = listnc;
                        listna.Add(na1);
                    }
                }
            }

            string Json = Newtonsoft.Json.JsonConvert.SerializeObject(listna);
            if (ReportModelA.WFStatus == "Draft" && OperatorType == 7)
            {
                ReportModelA.ReportApprove = null;
            }
            else
            {
                ReportModelA.ReportApprove = Json;
            }

            B_TargetplanOperator.Instance.UpdateTargetplan(ReportModelA);

            #endregion
        }
Example #2
0
        public List <NavigatActivity1> GetProcessIntance(string BusinessID, string UserLonginID = null)
        {
            var p = BPF.Workflow.Client.WFClientSDK.GetProcess(null, BusinessID, UserLonginID);
            List <NavigatActivity1> listna = new List <NavigatActivity1>();
            NavigatActivity1        na1    = null;
            Dictionary <string, BPF.Workflow.Object.Node> list = new Dictionary <string, Node>();
            string strNextNodeID = p.ProcessInstance.StartNodeID;

            foreach (var p1 in p.NodeInstanceList)
            {
                if (!string.IsNullOrEmpty(strNextNodeID))
                {
                    var CurrentNode = p.NodeInstanceList[strNextNodeID];
                    list.Add(strNextNodeID, CurrentNode);
                    strNextNodeID = CurrentNode.NextNodeID;
                }
            }
            foreach (var p1 in list)
            {
                if (string.IsNullOrEmpty(p1.Value.ParentNodeID))
                {
                    na1               = new NavigatActivity1();
                    na1.ActivityID    = p1.Value.NodeID;
                    na1.ActivityName  = p1.Value.NodeName;
                    na1.ActivityType  = p1.Value.NodeType;
                    na1.RunningStatus = (p1.Value.Status > 1 ? 3 : p1.Value.Status);
                    List <ClientOpinion1> listclientOp = new List <ClientOpinion1>();
                    listclientOp.Add(new ClientOpinion1()
                    {
                        CreateDate = p1.Value.FinishDateTime
                    });
                    na1.Opinions = listclientOp;

                    List <NavigatCandidate1> listnc = new List <NavigatCandidate1>();

                    var lstNode = p.NodeInstanceList.Where(s => s.Value.ParentNodeID == p1.Value.NodeID);
                    if (lstNode.Count() > 0)
                    {
                        foreach (var itme in lstNode)
                        {
                            listnc.Add(new NavigatCandidate1()
                            {
                                Id        = itme.Value.User.UserID,
                                Name      = itme.Value.User.UserName,
                                Title     = itme.Value.User.UserJobName,
                                DeptName  = itme.Value.User.UserOrgPathName,
                                Completed = itme.Value.Status == 2 ? true : false
                            });
                        }
                    }
                    else
                    {
                        listnc.Add(new NavigatCandidate1()
                        {
                            Id        = p1.Value.User.UserID,
                            Name      = p1.Value.User.UserName,
                            Title     = p1.Value.User.UserJobName,
                            DeptName  = p1.Value.User.UserOrgPathName,
                            Completed = p1.Value.Status == 2 ? true : false
                        });
                    }
                    na1.Candidates = listnc;
                    listna.Add(na1);
                }
            }
            return(listna);
        }