Ejemplo n.º 1
0
        /// <summary>
        /// 实现任务分配工作,该方法一般的实现逻辑是:
        /// 首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。
        /// 然后调用asignable.asignToActor(String actorId,Boolean needSign)或者
        /// asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds)
        /// 进行任务分配。
        /// </summary>
        /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param>
        /// <param name="performerName">角色名称</param>
        public void assign(IAssignable asignable, String performerName)// throws EngineException, KernelException
        {
            if (ActorIdsList == null || ActorIdsList.Count == 0)
            {
                TaskInstance taskInstance = (TaskInstance)asignable;
                throw new EngineException(taskInstance.ProcessInstanceId, taskInstance.WorkflowProcess, taskInstance.TaskId,
                                          "actorIdsList can not be empty");
            }

            List <IWorkItem> workItems = asignable.assignToActors(ActorIdsList);

            ITaskInstance taskInst = (ITaskInstance)asignable;

            //如果不需要签收,这里自动进行签收,(FormTask的strategy="all"或者=any并且工作项数量为1)
            if (!IsNeedClaim)
            {
                if (FormTaskEnum.ALL == taskInst.AssignmentStrategy || (FormTaskEnum.ANY == taskInst.AssignmentStrategy && ActorIdsList.Count == 1))
                {
                    for (int i = 0; i < workItems.Count; i++)
                    {
                        IWorkItem wi = workItems[i];
                        wi.claim();
                    }
                }
            }
        }
        /// <summary>
        /// <para>实现任务分配工作,该方法一般的实现逻辑是:</para>
        /// <para>首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。</para>
        /// <para>然后调用asignable.asignToActor(String actorId,Boolean needSign)或者</para>
        /// <para>asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds)</para>
        /// 进行任务分配。
        /// </summary>
        /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param>
        /// <param name="performerName">角色名称</param>
        public void assign(IAssignable asignable, string performerName)
        {
            ITaskInstance taskInst = (ITaskInstance)asignable;

            String roleName = performerName == null ? "" : performerName.Trim();
            List<String> users = new List<string>();
            switch (roleName)
            {
                case "WarehouseKeeper":
                    users = new List<string>() { "warehousekeeper1", "warehousekeeper2" };
                    break;
                case "Deliveryman":
                    users = new List<string>() { "deliveryman1", "deliveryman2", "deliveryman3" };
                    break;
                case "RiskEvaluator":
                    users = new List<string>() { "riskevaluator1", "riskevaluator2" };
                    break;
                case "Approver":
                    users = new List<string>() { "approver1", "approver2", "approver3" };
                    break;
                case "LendMoneyOfficer":
                    users = new List<string>() { "lendmoneyofficer1" };
                    break;
                default:
                    break;
            }
            if (users == null || users.Count <= 0)
            {
                throw new EngineException(taskInst.ProcessInstanceId,
                        taskInst.WorkflowProcess, taskInst.TaskId, "没有任何用户和角色" + performerName + "相关联,无法分配任务实例[id=" + taskInst.Id + ",任务名称=" + taskInst.DisplayName);
            }
            List<String> userIds = new List<string>();
            foreach (string item in users)
            {
                userIds.Add(item);
            }

            asignable.assignToActors(userIds);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <para>实现任务分配工作,该方法一般的实现逻辑是:</para>
        /// <para>首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。</para>
        /// <para>然后调用asignable.asignToActor(String actorId,Boolean needSign)或者</para>
        /// <para>asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds)</para>
        /// 进行任务分配。
        /// </summary>
        /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param>
        /// <param name="performerName">角色名称</param>
        public void assign(IAssignable asignable, string performerName)
        {
            ITaskInstance taskInst = (ITaskInstance)asignable;

            String        roleName = performerName == null ? "" : performerName.Trim();
            List <String> users    = new List <string>();

            switch (roleName)
            {
            case "WarehouseKeeper":
                users = new List <string>()
                {
                    "warehousekeeper1", "warehousekeeper2"
                };
                break;

            case "Deliveryman":
                users = new List <string>()
                {
                    "deliveryman1", "deliveryman2", "deliveryman3"
                };
                break;

            case "RiskEvaluator":
                users = new List <string>()
                {
                    "riskevaluator1", "riskevaluator2"
                };
                break;

            case "Approver":
                users = new List <string>()
                {
                    "approver1", "approver2", "approver3"
                };
                break;

            case "LendMoneyOfficer":
                users = new List <string>()
                {
                    "lendmoneyofficer1"
                };
                break;

            default:
                break;
            }
            if (users == null || users.Count <= 0)
            {
                throw new EngineException(taskInst.ProcessInstanceId,
                                          taskInst.WorkflowProcess, taskInst.TaskId, "没有任何用户和角色" + performerName + "相关联,无法分配任务实例[id=" + taskInst.Id + ",任务名称=" + taskInst.DisplayName);
            }
            List <String> userIds = new List <string>();

            foreach (string item in users)
            {
                userIds.Add(item);
            }

            asignable.assignToActors(userIds);
        }
Ejemplo n.º 4
-1
        // throws EngineException, KernelException
        /// <summary>
        /// 实现任务分配工作,该方法一般的实现逻辑是:
        /// 首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。
        /// 然后调用asignable.asignToActor(String actorId,Boolean needSign)或者
        /// asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds)
        /// 进行任务分配。
        /// </summary>
        /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param>
        /// <param name="performerName">角色名称</param>
        public void assign(IAssignable asignable, String performerName)
        {
            if (ActorIdsList == null || ActorIdsList.Count == 0)
            {
                TaskInstance taskInstance = (TaskInstance)asignable;
                throw new EngineException(taskInstance.ProcessInstanceId, taskInstance.WorkflowProcess, taskInstance.TaskId,
                    "actorIdsList can not be empty");
            }

            List<IWorkItem> workItems = asignable.assignToActors(ActorIdsList);

            ITaskInstance taskInst = (ITaskInstance)asignable;
            //如果不需要签收,这里自动进行签收,(FormTask的strategy="all"或者=any并且工作项数量为1)
            if (!IsNeedClaim)
            {
                if (FormTaskEnum.ALL==taskInst.AssignmentStrategy || (FormTaskEnum.ANY==taskInst.AssignmentStrategy && ActorIdsList.Count == 1))
                {
                    for (int i = 0; i < workItems.Count; i++)
                    {
                        IWorkItem wi = workItems[i];
                        wi.claim();
                    }
                }
            }
        }