示例#1
0
 /// <summary>
 /// 通过工作流实例ID和分支节点ID,获取当前分支节点所选的分支的名称
 /// </summary>
 /// <param name="InstanceID">工作流实例ID</param>
 /// <param name="NodeID">节点ID</param>
 /// <returns></returns>
 public static string[] GetSwitchName(string InstanceID, string NodeID)
 {
     try
     {
         string[] SwitchNames  = null;
         string   SwitchScript = CDataHelper.GetData("select switchscript from " + CTableName.FlowChartNode + " where [node_id]='" + NodeID + "'");
         if (SwitchScript == null || SwitchScript == "")
         {
             return(null);
         }
         else
         {
             object SwitchNameObj = CScriptOpe.ScriptExec(SwitchScript, InstanceID);
             if (SwitchNameObj == null || SwitchNameObj == "")
             {
                 return(null);
             }
             else
             {
                 SwitchNames = SwitchNameDecode(SwitchNameObj);
                 return(SwitchNames);
             }
         }
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取节点流转分支操作异常。实例ID:" + InstanceID + ",节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#2
0
 /// <summary>
 /// 根据不同的审批意见获取不同的下一级节点
 /// </summary>
 /// <param name="NodeID">当前节点ID</param>
 /// <param name="Apo"></param>
 /// <returns></returns>
 public static string GetNextNodeIDByCurrentNodeID(string NodeID, EApprovalOpinion Apo)
 {
     try
     {
         string WFID = CWFManager.GetWFIDByNodeID(NodeID);
         if (Apo == EApprovalOpinion.意)
         {
             return(CDataHelper.GetData("select next_node_id from " + CTableName.FlowChartLine + " where node_id='" + NodeID + "'"));
         }
         else if (Apo == EApprovalOpinion.意)
         {
             return(CDataHelper.GetData("select [node_id] from " + CTableName.FlowChartNode + " where [flowchart_id]='" + WFID + "' and [nodetype]='" + CNodeType.EndType + "'"));
         }
         else if (Apo == EApprovalOpinion.驳回上级)
         {
             return(GetUpApprovalNodeID(NodeID));
         }
         else
         {
             return(GetStartNodeID(WFID));
         }
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("通过节点ID获取下一个节点ID操作异常。节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#3
0
        public bool IsNodeAllAgree(string InstanceID, string NodeID)
        {
            try
            {
                int ApprovalNum = CApprovalManager.GetLastApprovalNum(InstanceID, NodeID);
                if (ApprovalNum == 0)
                {
                    return(false);
                }

                string strUnCompleteNum = CDataHelper.GetData("select count(*) from " + CTableName.FlowChartReceiver + " where instance_id='" + InstanceID + "' and node_id='" + NodeID + "' and approval_num='" + ApprovalNum + "' and approval_status<>'" + EApprovalStatus.Complete.ToString() + "'");
                if (strUnCompleteNum != "0")
                {
                    return(false);
                }

                string strUnAgreeNum = CDataHelper.GetData("select count(*) from " + CTableName.FlowChartReceiver + " where instance_id='" + InstanceID + "' and node_id='" + NodeID + "' and approval_num='" + ApprovalNum + "' and approval_opinion<>'" + EApprovalStatus.Complete.ToString() + "' and approval_opinion<>NULL and approval_opinion<>''");
                if (strUnAgreeNum != "0")
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                CLog.PutDownErrInfo("判断节点审批人是否都同意操作异常。实例ID:" + InstanceID + ",节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
                throw ex;
            }
        }
示例#4
0
 /// <summary>
 /// 获取各个审批意见对应的处理脚本
 /// </summary>
 /// <param name="NodeID"></param>
 /// <param name="ApprovalOpinion"></param>
 /// <returns></returns>
 public static string GetApprovalScript(string NodeID, EApprovalOpinion ApprovalOpinion)
 {
     try
     {
         return(CDataHelper.GetData("select [approvescript] from " + CTableName.FlowChartNodeApproveItem + " where node_id='" + NodeID + "' and [approvename]='" + ApprovalOpinion.ToString() + "'"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#5
0
 /// <summary>
 /// 通过SwitchID获取下一个节点ID
 /// </summary>
 /// <param name="SwitchID"></param>
 /// <returns></returns>
 public static string GetNextNodeIDBySwitchID(string SwitchID)
 {
     try
     {
         return(CDataHelper.GetData("select next_node_id from " + CTableName.FlowChartLine + " where [sourcepoint]='" + SwitchID + "-out'"));;
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("通过SwitchID获取下一个节点ID操作异常。SwitchID:" + SwitchID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#6
0
 public static string GetWFIDByNodeID(string NodeID)
 {
     try
     {
         return(CDataHelper.GetData("select flowchart_id from " + CTableName.FlowChartNode + " where node_id='" + NodeID + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取节点所属工作流ID操作异常,异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#7
0
 /// <summary>
 /// 获取最后一个版本号
 /// </summary>
 /// <param name="WFName"></param>
 /// <returns></returns>
 public static string GetLastVersion(string WFName)
 {
     try
     {
         return(CDataHelper.GetData("select top 1 isnull(flowchart_version,'') as flowchart_version from " + CTableName.FlowChart + " where flowchart_name='" + WFName + "' order by id desc"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取工作流" + WFName + "的最后一个版本号操作异常,异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#8
0
 /// <summary>
 /// 获取审批人最后一次审批意见
 /// </summary>
 /// <param name="InstanceID"></param>
 /// <param name="NodeID"></param>
 /// <param name="ApproverID"></param>
 /// <returns></returns>
 public static string GetNodeApprovalOpinion(string InstanceID, string NodeID, string ApproverID)
 {
     try
     {
         return(CDataHelper.GetData("select top 1 approval_opinion from " + CTableName.FlowChartReceiver + " where instance_id='" + InstanceID + "' and node_id='" + NodeID + "' and user_id='" + ApproverID + "' order by approval_num desc"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取节点审批意见操作异常。实例ID:,节点ID:,审批人:,异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#9
0
 /// <summary>
 /// 获取开始节点
 /// </summary>
 /// <param name="WFID"></param>
 /// <returns></returns>
 public static string GetStartNodeID(string WFID)
 {
     try
     {
         return(CDataHelper.GetData("select [node_id] from " + CTableName.FlowChartNode + " where [flowchart_id]='" + WFID + "' and [nodetype]='" + CNodeType.StartType + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取工作流的开始节点操作异常。工作流ID:" + WFID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
 /// <summary>
 /// 获取工作流实例的发起人ID
 /// </summary>
 /// <param name="InstanceID"></param>
 /// <returns></returns>
 public static string GetInstanceStartManID(string InstanceID)
 {
     try
     {
         return(CDataHelper.GetData("select cre_man from " + CTableName.FlowChartInstance + " where instance_id='" + InstanceID + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取工作流实例发起人ID操作异常。实例ID:" + InstanceID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#11
0
 public static string GetNodeScript(string NodeID, EScriptType ScriptType)
 {
     try
     {
         return(CDataHelper.GetData("select " + ScriptType.ToString() + " from " + CTableName.FlowChartNode + " where  node_id='" + NodeID + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取节点脚本操作异常。节点ID:" + NodeID + ",脚本类型:" + ScriptType.ToString() + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#12
0
 /// <summary>
 /// 获取上一级节点
 /// </summary>
 /// <param name="NodeID">当前节点ID</param>
 /// <returns></returns>
 public static string GetUpNodeID(string NodeID)
 {
     try
     {
         return(CDataHelper.GetData("select node_id from " + CTableName.FlowChartLine + " where next_node_id='" + NodeID + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("通过节点ID获取上一个节点ID操作异常。节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#13
0
 /// <summary>
 /// 获取节点类型
 /// </summary>
 /// <param name="NodeID"></param>
 /// <returns></returns>
 public static string GetNodeType(string NodeID)
 {
     try
     {
         return(CDataHelper.GetData("select [nodetype] from " + CTableName.FlowChartNode + " where [node_id]='" + NodeID + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取节点类型操作异常。节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#14
0
 /// <summary>
 /// 通过Switch名称获取SwitchID
 /// </summary>
 /// <param name="SwitchNodeID"></param>
 /// <param name="SwitchName"></param>
 /// <returns></returns>
 public static string GetSwitchIDBySwitchName(string SwitchNodeID, string SwitchName)
 {
     try
     {
         return(CDataHelper.GetData("select [switchid] from " + CTableName.FlowChartSwitchitem + " where [node_id]='" + SwitchNodeID + "' and [switchname]='" + SwitchName + "'"));
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("通过SwitchName获取SwitchID操作异常。节点ID:" + SwitchNodeID + ",SwitchName:" + SwitchName + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
 /// <summary>
 /// 获取审批人
 /// </summary>
 /// <param name="InstanceID"></param>
 /// <param name="NodeID"></param>
 /// <returns></returns>
 public static DataTable GetApprover(string InstanceID, string NodeID)
 {
     try
     {
         string    ApproverScript = CDataHelper.GetData("select [operatorscript] from " + CTableName.FlowChartNode + " where [node_id]='" + NodeID + "'");
         DataTable dtApprover     = (DataTable)CScriptOpe.ScriptExec(ApproverScript, InstanceID);
         return(dtApprover);
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取审批人操作异常。实例ID:,节点ID:,异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
 /// <summary>
 /// 获取该节点最后一次审批是第几次审批
 /// </summary>
 /// <param name="InstanceID"></param>
 /// <param name="NodeID"></param>
 /// <returns></returns>
 public static int GetLastApprovalNum(string InstanceID, string NodeID)
 {
     try
     {
         string strApprovalNum = CDataHelper.GetData("select top 1 approval_num from " + CTableName.FlowChartReceiver + " where instance_id='" + InstanceID + "' and node_id='" + NodeID + "' order by approval_num desc");
         int    ApprovalNum    = 0;
         if (strApprovalNum != null && strApprovalNum != "")
         {
             ApprovalNum = Convert.ToInt32(strApprovalNum);
         }
         return(ApprovalNum);
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取最后的审批次数操作异常。实例ID:" + InstanceID + ",节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
 /// <summary>
 /// 获取审批提示信息
 /// </summary>
 /// <param name="InstanceID"></param>
 /// <param name="NodeID"></param>
 /// <returns></returns>
 public static string GetApprovalNote(string InstanceID, string NodeID)
 {
     try
     {
         string strApprovalNote    = null;
         string ApprovalNoteScript = CDataHelper.GetData("select [approvalnotescript] from " + CTableName.FlowChartNode + " where [node_id]='" + NodeID + "'");
         if (ApprovalNoteScript != null && ApprovalNoteScript != "")
         {
             strApprovalNote = (string)CScriptOpe.ScriptExec(ApprovalNoteScript, InstanceID);
         }
         return(strApprovalNote);
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("获取审批提示操作异常。实例ID:,节点ID:,异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }
示例#18
0
 /// <summary>
 /// 获取非分支节点的下一级节点ID
 /// </summary>
 /// <param name="WFID"></param>
 /// <param name="InstanceID"></param>
 /// <param name="NodeID"></param>
 /// <returns></returns>
 public static string GoNextNodesFromOtherNode(string InstanceID, string NodeID)
 {
     try
     {
         string NextNodeID = CDataHelper.GetData("select next_node_id from " + CTableName.FlowChartLine + " where node_id='" + NodeID + "'");
         if (NextNodeID == null || NextNodeID == "")
         {
             WFGlobal.ErrInfo = CLog.PutDownErrInfo("找不到节点" + NodeID + "的下一个节点。");
             return(WFGlobal.ErrInfo);
         }
         return(NodeTransfer(InstanceID, NodeID, NextNodeID));
     }
     catch (Exception ex)
     {
         WFGlobal.ErrInfo = CLog.PutDownErrInfo("获取节点的下一个节点操作失败。工作流实例ID:" + InstanceID + ",节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         return(WFGlobal.ErrInfo);
     }
 }
示例#19
0
 /// <summary>
 /// 判断该节点的所有审批人员是否都已完成审批
 /// </summary>
 /// <param name="InstanceID"></param>
 /// <param name="NodeID"></param>
 /// <returns></returns>
 public static bool IsNodeApprovalComplete(string InstanceID, string NodeID)
 {
     try
     {
         string ReceiverCount = CDataHelper.GetData("select count(*) from " + CTableName.FlowChartReceiver + " where instance_id='" + InstanceID + "' and node_id='" + NodeID + "'");
         string CompleteCount = CDataHelper.GetData("select count(*) from " + CTableName.FlowChartReceiver + " where instance_id='" + InstanceID + "' and node_id='" + NodeID + "' and approval_status='" + EApprovalStatus.Complete.ToString() + "'");
         if (ReceiverCount == CompleteCount)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         CLog.PutDownErrInfo("判断节点审批状态是否已结束操作异常。实例ID:" + InstanceID + ",节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
         throw ex;
     }
 }