示例#1
0
        public string GetWorkFlowActivityByCode(string workFlowCode)
        {
            BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo);
            string workFlowId = workFlowProcessManager.GetId(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldDeletionStateCode, 0), new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldCode, workFlowCode));

            return(GetWorkFlowActivity(workFlowId));
        }
示例#2
0
        public string GetWorkFlowActivityByOrganize(string organizeId, string billTemplateId)
        {
            BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo);
            string workFlowId = workFlowProcessManager.GetId(
                new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldDeletionStateCode, 0)
                , new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldOrganizeId, organizeId)
                , new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldBillTemplateId, billTemplateId));

            return(GetWorkFlowActivity(workFlowId));
        }
示例#3
0
        /// <summary>
        /// 获取第一步审核的
        /// </summary>
        /// <param name="categoryCode">单据分类</param>
        /// <param name="workFlowCode">审批流程编号</param>
        /// <returns>审核步骤</returns>
        public BaseWorkFlowActivityEntity GetFirstActivityEntity(string workFlowCode, string categoryCode = null)
        {
            BaseWorkFlowActivityEntity workFlowActivityEntity = null;

            string    workFlowId = string.Empty;
            DataTable dt         = null;
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            // 这里是获取用户的工作流, 按用户主键,按模板编号
            if (string.IsNullOrEmpty(workFlowCode))
            {
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldCategoryCode, categoryCode));
                parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowBillTemplateEntity.FieldDeletionStateCode, 0));
                BaseWorkFlowBillTemplateManager templateManager = new BaseWorkFlowBillTemplateManager(this.DbHelper, this.UserInfo);
                dt = templateManager.GetDataTable(parameters);
                BaseWorkFlowBillTemplateEntity templateEntity = BaseEntity.Create <BaseWorkFlowBillTemplateEntity>(dt);
                if (!string.IsNullOrEmpty(templateEntity.Id))
                {
                    workFlowCode = this.UserInfo.Id + "_" + templateEntity.Id;
                }
            }
            if (string.IsNullOrEmpty(workFlowCode))
            {
                return(null);
            }
            // 1. 先检查工作流是否存在?
            BaseWorkFlowProcessManager workFlowProcessManager = new BaseWorkFlowProcessManager(this.DbHelper, this.UserInfo);

            parameters = new List <KeyValuePair <string, object> >();
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldCode, workFlowCode));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowProcessEntity.FieldDeletionStateCode, 0));

            string[] names  = new string[] { BaseWorkFlowProcessEntity.FieldCode, BaseWorkFlowProcessEntity.FieldEnabled, BaseWorkFlowProcessEntity.FieldDeletionStateCode }; // 2010.01.25 LiangMingMing 将 BaseWorkFlowProcessEntity.FieldCode 改 BaseWorkFlowProcessEntity.FieldId
            object[] values = new object[] { workFlowCode, 1, 0 };
            workFlowId = workFlowProcessManager.GetId(parameters);
            if (string.IsNullOrEmpty(workFlowId))
            {
                return(null);
            }
            // 2. 查找第一步是按帐户审核?还是按角色审核?
            BaseWorkFlowActivityManager workFlowActivityManager = new BaseWorkFlowActivityManager(this.DbHelper, this.UserInfo);

            // 2010.01.25 LiangMingMing 新加了两个参数new string[] { BaseWorkFlowActivityEntity.FieldProcessId }, new string[] { Convert.ToString(workFlowId) },(具体获取哪个流程的步骤)

            parameters = new List <KeyValuePair <string, object> >();
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldProcessId, workFlowId.ToString()));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair <string, object>(BaseWorkFlowActivityEntity.FieldDeletionStateCode, 0));

            dt = workFlowActivityManager.GetDataTable(parameters);
            // 3. 取第一个排序的数据
            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            workFlowActivityEntity = BaseEntity.Create <BaseWorkFlowActivityEntity>(dt.Rows[0]);
            if ((workFlowActivityEntity.AuditUserId == null) && (workFlowActivityEntity.AuditRoleId == null))
            {
                return(null);
            }
            return(workFlowActivityEntity);
        }