/// <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 ApplyTransfer(Dictionary <string, string> vallist, int todoID, string operationUserCode, Operation operationType, string common, FlowContent flowcontent, FlowNode node) { //NodeReturn ret = node.Run(flowcontent); WF_ToDo preTodo = todobll.getPreTransferTodo(todoID); if (preTodo != null) { //int newtodiid = ToDoHandle.Reopen(preTodo.ResponseUserCode, preTodo.InstanceID, preTodo.IsShow, preTodo.PrevID, preTodo.ToDoName, preTodo.TodoType, node, preTodo.Nodekey, operationUserCode); //flowcontent.CurrentTodoID = string.Join(", ", newtodiid); if (preTodo.TodoType == (int)TodoType.Normal) { FlowNode befornode = NodeFactory.getFlowNode(flowcontent.TmpKey, preTodo.Nodekey, this.endFlow); NodeReturn ret = befornode.Run(flowcontent); //获取当前待办人的编号 List <string> newtodis = new List <string>(); List <string> newnodekey = new List <string>(); if (ret.isOver) { List <FlowNode> nextNode = befornode.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, befornode, befornode.NodeKey, CurrenUserCode); newtodis.Add(todoid.ToString()); } } newnodekey.Add(befornode.NodeKey); flowcontent.CurrentNodeKey = string.Join(", ", newnodekey); flowcontent.CurrentTodoID = string.Join(", ", newtodis); } } if (preTodo.TodoType == (int)TodoType.Add) { WF_ToDo beforTodo = todobll.getPreAddTodo(todoID); while (beforTodo.TodoType == (int)TodoType.Add) { beforTodo = todobll.getPreAddTodo(beforTodo.ID); } FlowNode befornode = NodeFactory.getFlowNode(flowcontent.TmpKey, beforTodo.Nodekey, this.endFlow); int newtodiid = ToDoHandle.Reopen(beforTodo.ResponseUserCode, beforTodo.InstanceID, beforTodo.IsShow, beforTodo.PrevID, beforTodo.ToDoName, beforTodo.TodoType, befornode, beforTodo.Nodekey, operationUserCode); flowcontent.CurrentTodoID = string.Join(", ", newtodiid); } if (preTodo.TodoType == (int)TodoType.Redirect) { ApplyTransfer(vallist, preTodo.ID, operationUserCode, operationType, common, flowcontent, node); } } }
/// <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); }