Exemplo n.º 1
0
 public string TerminateInstance(string InstanceID)
 {
     try
     {
         if (WFGlobal.ServerStarted == true)
         {
             return(CInstanceManager.SetInstanceComplete(InstanceID));
         }
         WFGlobal.ErrInfo = CLog.PutDownErrInfo("停止工作流实例操作失败,工作流服务未启动。工作流实例ID:" + InstanceID);
         return(WFGlobal.ErrInfo);
     }
     catch (Exception ex)
     {
         WFGlobal.ErrInfo = CLog.PutDownErrInfo("停止工作流实例操作失败,工作流服务未启动。工作流实例ID:" + InstanceID + ",异常信息:" + ex.Message.ToString());
         return(WFGlobal.ErrInfo);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 节点转移,从当前节点进入下一节点
        /// </summary>
        /// <param name="WFID"></param>
        /// <param name="InstanceID"></param>
        /// <param name="NodeID"></param>
        /// <param name="NextNodeID"></param>
        public static string NodeTransfer(string InstanceID, string NodeID, string NextNodeID)
        {
            try
            {
                if (CNodeManager.IsNodeThroughEnable(InstanceID, NextNodeID))
                {
                    //记录流转历史
                    if (CDataHelper.ExecuteNonQuery("insert into " + CTableName.FlowChartHistory + "(instance_id,node_id,next_node_id) values('" + InstanceID + "','" + NodeID + "','" + NextNodeID + "')") < 0)
                    {
                        WFGlobal.ErrInfo = CLog.PutDownErrInfo("记录工作流实例流转节点失败,工作流实例ID:" + InstanceID + ",开始节点ID:" + NodeID + ",结束节点ID:" + NextNodeID);
                        return(WFGlobal.ErrInfo);
                    }

                    string NodeType = CNodeManager.GetNodeType(NextNodeID);
                    if (NodeType == CNodeType.SwitchType)
                    {
                        return(GoNextNodesFromSwitchNode(InstanceID, NextNodeID));
                    }
                    else if (NodeType == CNodeType.ProcessType)
                    {
                        RunProcessScript(InstanceID, NextNodeID);
                        return(CNodeManager.GoNextNodesFromOtherNode(InstanceID, NextNodeID));
                    }
                    else if (NodeType == CNodeType.ApproveType || NodeType == CNodeType.StartType)
                    {
                        return(CNodeManager.PutDownNodeApprover(InstanceID, NextNodeID));
                    }
                    else if (NodeType == CNodeType.EndType)
                    {
                        return(CInstanceManager.SetInstanceComplete(InstanceID));
                    }
                }
                return(WFGlobal.success);
            }
            catch (Exception ex)
            {
                WFGlobal.ErrInfo = CLog.PutDownErrInfo("节点流转异常,工作流实例ID:" + InstanceID + ",开始节点ID:" + NodeID + ",结束节点ID:" + NextNodeID);
                return(WFGlobal.ErrInfo);
            }
        }