Пример #1
0
        /// <summary>
        /// 加签
        /// </summary>
        /// <param name="vallist"></param>
        /// <param name="befortodoID"></param>
        /// <param name="operationUserCode"></param>
        /// <param name="operationType"></param>
        /// <param name="common"></param>
        /// <param name="flowcontent"></param>
        /// <param name="node"></param>
        /// <param name="toNodeKey"></param>
        private void Add(Dictionary <string, string> vallist, int befortodoID, string operationUserCode, Operation operationType, string common, FlowContent flowcontent, FlowNode node, string todoUserCode)
        {
            ToDoHandle.DealTodo((int)operationType, operationUserCode, befortodoID);
            FlowVar var = new FlowVar(flowcontent.TmpKey, flowcontent.CurrentInstanceID);

            var.UpdateVal(vallist, this.CurrenUserCode);
            //获取当前待办人的编号
            List <string> newtodis   = new List <string>();
            List <string> newnodekey = new List <string>();
            int           todoid     = ToDoHandle.InsertTodo(todoUserCode.Trim(), flowcontent.CurrentInstanceID, (int)TodoIsShow.Show, befortodoID, flowcontent.TaskName, (int)TodoType.Add, node, node.NodeKey, CurrenUserCode);

            newtodis.Add(todoid.ToString());
            flowcontent.CurrentTodoID  = string.Join(", ", newtodis);
            flowcontent.CurrentNodeKey = node.NodeKey;
            operationbll.Insert(flowcontent.CurrentInstanceID, befortodoID, CurrenUserCode, (int)operationType, common);
            //插入转签历史记录
            WF_Sign sign = new WF_Sign();

            sign.AfterToDoID       = todoid;
            sign.beforeToDoID      = befortodoID;
            sign.IsDelete          = (int)IsDelete.UnDelete;
            sign.State             = (int)State.Enable;
            sign.OperationTime     = DateTime.Now;
            sign.OperationUserCode = operationUserCode;
            Employee emp = empbll.getbyUserCode(operationUserCode);

            if (emp != null)
            {
                sign.OperationUserName = emp.UserName;
            }
            signbll.save(sign);
        }
Пример #2
0
        /// <summary>
        /// 驳回
        /// </summary>
        /// <param name="vallist"></param>
        /// <param name="todoID"></param>
        /// <param name="operationUserCode"></param>
        /// <param name="operationType"></param>
        /// <param name="common"></param>
        /// <param name="flowcontent"></param>
        /// <param name="node"></param>
        /// <param name="toNodeKey"></param>
        private void Reject(Dictionary <string, string> vallist, int todoID, string operationUserCode, Operation operationType, string common, FlowContent flowcontent, FlowNode node, string toNodeKey)
        {
            ToDoHandle.DealTodo((int)operationType, operationUserCode, todoID);
            FlowVar var = new FlowVar(flowcontent.TmpKey, flowcontent.CurrentInstanceID);

            var.UpdateVal(vallist, this.CurrenUserCode);

            List <WF_ToDo> undolist = todobll.getList(flowcontent.CurrentInstanceID, node.NodeKey, (int)TodoState.UnDo);

            if (undolist != null && undolist.Count > 0)
            {
                foreach (WF_ToDo item in undolist)
                {
                    ToDoHandle.DeleteTodo((int)operationType, operationUserCode, item.ID);
                }
            }
            WF_TemplateNode tmpnode = nodebll.getByNodeKey(flowcontent.TmpKey, node.NodeKey);

            if (tmpnode.IsGoBack == 0)
            {
                throw new Exception("改节点禁止退回");
            }
            if (tmpnode.GoBackType == "every")
            {
                if (string.IsNullOrWhiteSpace(toNodeKey))
                {
                    throw new Exception("请选择需要退回到哪一个节点");
                }
            }
            else
            {
                toNodeKey = tmpnode.GoBackType;
            }
            FlowNode toNode = NodeFactory.getFlowNode(flowcontent.TmpKey, toNodeKey, this.endFlow);

            NodeReturn ret = toNode.Run(flowcontent);

            //获取当前待办人的编号
            List <string> newtodis   = new List <string>();
            List <string> newnodekey = new List <string>();

            if (!ret.isOver)
            {
                List <string> userCodeList = ret.ToDoUserList;
                //循环遍历插入待办
                if (userCodeList != null && userCodeList.Count > 0)
                {
                    foreach (string user in userCodeList)
                    {
                        int todoid = ToDoHandle.InsertTodo(user.Trim(), flowcontent.CurrentInstanceID, (int)TodoIsShow.Show, -1, flowcontent.TaskName, (int)TodoType.Normal, toNode, toNode.NodeKey, CurrenUserCode);
                        newtodis.Add(todoid.ToString());
                    }
                }
                flowcontent.CurrentTodoID  = string.Join(", ", newtodis);
                flowcontent.CurrentNodeKey = toNodeKey;
            }
            operationbll.Insert(flowcontent.CurrentInstanceID, todoID, CurrenUserCode, (int)operationType, common);
        }
Пример #3
0
        /// <summary>
        /// 跳转
        /// </summary>
        /// <param name="vallist"></param>
        /// <param name="todoID"></param>
        /// <param name="operationUserCode"></param>
        /// <param name="operationType"></param>
        /// <param name="common"></param>
        /// <param name="flowcontent"></param>
        /// <param name="node"></param>
        private void GoTo(Dictionary <string, string> vallist, int todoID, string operationUserCode, Operation operationType, string common, FlowContent flowcontent, FlowNode node, string toNodeKey)
        {
            ToDoHandle.DealTodo((int)operationType, operationUserCode, todoID);
            FlowVar var = new FlowVar(flowcontent.TmpKey, flowcontent.CurrentInstanceID);

            var.UpdateVal(vallist, this.CurrenUserCode);

            List <WF_ToDo> undolist = todobll.getList(flowcontent.CurrentInstanceID, node.NodeKey, (int)TodoState.UnDo);

            if (undolist != null && undolist.Count > 0)
            {
                foreach (WF_ToDo item in undolist)
                {
                    ToDoHandle.DeleteTodo((int)operationType, operationUserCode, item.ID);
                }
            }
            FlowNode toNode = NodeFactory.getFlowNode(flowcontent.TmpKey, toNodeKey, this.endFlow);

            NodeReturn ret = toNode.Run(flowcontent);

            //获取当前待办人的编号
            List <string> newtodis   = new List <string>();
            List <string> newnodekey = new List <string>();

            if (!ret.isOver)
            {
                List <string> userCodeList = ret.ToDoUserList;
                //循环遍历插入待办
                if (userCodeList != null && userCodeList.Count > 0)
                {
                    foreach (string user in userCodeList)
                    {
                        int todoid = ToDoHandle.InsertTodo(user.Trim(), flowcontent.CurrentInstanceID, (int)TodoIsShow.Show, -1, flowcontent.TaskName, (int)TodoType.Normal, toNode, toNode.NodeKey, CurrenUserCode);
                        newtodis.Add(todoid.ToString());
                    }
                }
                flowcontent.CurrentTodoID  = string.Join(", ", newtodis);
                flowcontent.CurrentNodeKey = toNodeKey;
            }
            operationbll.Insert(flowcontent.CurrentInstanceID, todoID, CurrenUserCode, (int)operationType, common);
        }
Пример #4
0
        /// <summary>
        /// 同意
        /// </summary>
        /// <param name="vallist"></param>
        /// <param name="todoID"></param>
        /// <param name="operationUserCode"></param>
        /// <param name="operationType"></param>
        /// <param name="common"></param>
        /// <param name="flowcontent"></param>
        /// <param name="node"></param>
        private void Apply(Dictionary <string, string> vallist, int todoID, string operationUserCode, Operation operationType, string common, FlowContent flowcontent, FlowNode node)
        {
            ToDoHandle.DealTodo((int)operationType, operationUserCode, todoID);
            FlowVar var = new FlowVar(flowcontent.TmpKey, flowcontent.CurrentInstanceID);

            var.UpdateVal(vallist, this.CurrenUserCode);
            WF_ToDo todo = todobll.getByID(todoID);

            // 加签类型
            if (todo.TodoType == (int)TodoType.Add)
            {
                WF_ToDo nextodo   = todobll.getPreAddTodo(todoID);
                int     newtodiid = ToDoHandle.Reopen(nextodo.ResponseUserCode, nextodo.InstanceID, nextodo.IsShow, nextodo.PrevID, nextodo.ToDoName, nextodo.TodoType, node, nextodo.Nodekey, operationUserCode);
                flowcontent.CurrentTodoID = string.Join(", ", newtodiid);
            }
            //todo 转签处理,如果找到最近一个加签类型,然后生成加签待办,如果不是从加签转过来的,就直接到下一个节点
            if (todo.TodoType == (int)TodoType.Redirect)
            {
                ApplyTransfer(vallist, todoID, operationUserCode, operationType, common, flowcontent, node);
            }
            // 一般同意 转签类型
            if (todo.TodoType == (int)TodoType.Normal)
            {
                NodeReturn ret = node.Run(flowcontent);

                //获取当前待办人的编号
                List <string> newtodis   = new List <string>();
                List <string> newnodekey = new List <string>();
                if (ret.isOver)
                {
                    List <FlowNode> nextNode = node.GetNextNode(flowcontent);
                    if (nextNode != null && nextNode.Count > 0)
                    {
                        foreach (FlowNode nxitem in nextNode)
                        {
                            NodeReturn noderet = nxitem.Run(flowcontent);
                            if (!noderet.isOver)
                            {
                                newnodekey.Add(nxitem.NodeKey);
                                List <string> userCodeList = noderet.ToDoUserList;
                                //循环遍历插入待办
                                if (userCodeList != null && userCodeList.Count > 0)
                                {
                                    foreach (string user in userCodeList)
                                    {
                                        int todoid = ToDoHandle.InsertTodo(user.Trim(), flowcontent.CurrentInstanceID, (int)TodoIsShow.Show, -1, flowcontent.TaskName, (int)TodoType.Normal, nxitem, nxitem.NodeKey, CurrenUserCode);
                                        newtodis.Add(todoid.ToString());
                                    }
                                }
                            }
                        }
                    }
                    flowcontent.CurrentNodeKey = string.Join(", ", newnodekey);
                    flowcontent.CurrentTodoID  = string.Join(", ", newtodis);
                }
                else
                {
                    List <string> userCodeList = ret.ToDoUserList;
                    //循环遍历插入待办
                    if (userCodeList != null && userCodeList.Count > 0)
                    {
                        foreach (string user in userCodeList)
                        {
                            int todoid = ToDoHandle.InsertTodo(user.Trim(), flowcontent.CurrentInstanceID, (int)TodoIsShow.Show, -1, flowcontent.TaskName, (int)TodoType.Normal, node, node.NodeKey, CurrenUserCode);
                            newtodis.Add(todoid.ToString());
                        }
                    }
                    newnodekey.Add(node.NodeKey);
                    flowcontent.CurrentNodeKey = string.Join(", ", newnodekey);
                    flowcontent.CurrentTodoID  = string.Join(", ", newtodis);
                }
            }
            operationbll.Insert(flowcontent.CurrentInstanceID, todoID, CurrenUserCode, (int)operationType, common);
        }