예제 #1
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;
            }
        }
예제 #2
0
        /// <summary>
        /// 记录节点的审批人
        /// </summary>
        /// <param name="InstanceID"></param>
        /// <param name="NodeID"></param>
        public static string PutDownNodeApprover(string InstanceID, string NodeID)
        {
            try
            {
                string nodetype = CNodeManager.GetNodeType(NodeID);
                if (nodetype == null)
                {
                    WFGlobal.ErrInfo = CLog.PutDownErrInfo("获取节点" + NodeID + "的节点类型失败,工作流实例ID:" + InstanceID);
                    CInstanceManager.SetInstanceError(InstanceID, WFGlobal.ErrInfo);
                    return(WFGlobal.ErrInfo);
                }

                int ApprovalNum = CApprovalManager.GetLastApprovalNum(InstanceID, NodeID);
                //判断是否开始流程
                if (nodetype == CNodeType.StartType)
                {
                    string StartManID = CInstanceManager.GetInstanceStartManID(InstanceID);
                    if (StartManID == null)
                    {
                        WFGlobal.ErrInfo = CLog.PutDownErrInfo("获取流程实例的发起人失败,工作流实例ID:" + InstanceID);
                        CInstanceManager.SetInstanceError(InstanceID, WFGlobal.ErrInfo);
                        return(WFGlobal.ErrInfo);
                    }

                    string ApprovalNote = CApprovalManager.GetApprovalNote(InstanceID, NodeID);

                    string PutDownApproverResult = CApprovalManager.PutDownApprover(InstanceID, NodeID, StartManID, ApprovalNum + 1, ApprovalNote);
                    if (PutDownApproverResult != WFGlobal.success)
                    {
                        return(PutDownApproverResult);
                    }
                }
                //判断流程是否结束
                else if (nodetype != CNodeType.EndType)
                {
                    DataTable dtReceiver   = CApprovalManager.GetApprover(InstanceID, NodeID);
                    string    ApprovalNote = CApprovalManager.GetApprovalNote(InstanceID, NodeID);
                    if (dtReceiver != null)
                    {
                        if (dtReceiver.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtReceiver.Rows.Count; i++)
                            {
                                string ReceiverID            = dtReceiver.Rows[i][WFGlobal.UserID].ToString();
                                string PutDownApproverResult = CApprovalManager.PutDownApprover(InstanceID, NodeID, ReceiverID, ApprovalNum + 1, ApprovalNote);
                                if (PutDownApproverResult != WFGlobal.success)
                                {
                                    return(PutDownApproverResult);
                                }
                            }
                        }
                    }
                }
                return(WFGlobal.success);
            }
            catch (Exception ex)
            {
                WFGlobal.ErrInfo = CLog.PutDownErrInfo("记录节点审批人操作异常。工作流实例ID:" + InstanceID + ",节点ID:" + NodeID + ",异常信息:" + ex.Message.ToString());
                return(WFGlobal.ErrInfo);
            }
        }