コード例 #1
0
        /// <summary>
        /// 工单用户审核
        /// </summary>
        /// <param name="condtion">审批请求</param>
        /// <param name="userInfo">审批用户信息</param>
        public void DoWorkFlowUserConfirm(BaseWorkOrderUserConfirmReqeust condtion, ICommunicationable userInfo)
        {
            //权限验证
            var    nowTaskUsers = GetTaskUsersByStepId(this.WorkFlowBookMarkId);
            string userId       = userInfo.getIdString();
            var    stepInfo     = WorkFlowDefStep.GetInstance(this.WorkFlowBookMarkId);

            if (DoWorkFlowUserConfirmBefore(condtion, nowTaskUsers, userInfo, stepInfo))
            {
                var taskUserInfo = nowTaskUsers.Single(p => p.UserId == userId);
                taskUserInfo.IsConfirm         = true;
                taskUserInfo.ConfirmTime       = DateTime.Now;
                taskUserInfo.ConfirmTimeString = taskUserInfo.ConfirmTime.Value.ToString("yyyy-MM-dd HH:mm");
                taskUserInfo.Remark            = condtion.Remark;
                taskUserInfo.SaveConfirm();
                string msg = string.Format("工作流用户审批,步骤:[{0}],备注:[{1}]", stepInfo.name, condtion.Remark);
                UserLog.create(msg, "工作流", userInfo, this);

                //执行下一步
                var next = stepInfo.GetNextLineDetails();
                DoWorkFlowUserConfirmAfter(condtion, nowTaskUsers, taskUserInfo, stepInfo, next, userInfo);
            }
            else
            {
                throw new ValiDataException("用户审批前置验证失败,无法进行审批");
            }

            if (!nowTaskUsers.Select(p => p.UserId).Contains(userId))
            {
                throw new ValiDataException("您没有审批该流程的权限");
            }
        }
コード例 #2
0
 /// <summary>
 /// 【具体业务根据需要重写】工单用户审批后 - 默认为判断是否会签 并执行下一步
 /// </summary>
 /// <param name="condtion">审批请求</param>
 /// <param name="nowTaskUsers">步骤全部审批人</param>
 /// <param name="taskUserInfo">步骤当前审批人</param>
 /// <param name="stepInfo">步骤信息</param>
 /// <param name="nextLines">步骤的下一步信息</param>
 /// <param name="userInfo">当前步骤审批人的其他信息</param>
 protected virtual void DoWorkFlowUserConfirmAfter(BaseWorkOrderUserConfirmReqeust condtion, List <BaseWorkOrderTaskUserInfo> nowTaskUsers, BaseWorkOrderTaskUserInfo taskUserInfo, WorkFlowDefStep stepInfo, List <WorkFlowDefLineDetail> nextLines, ICommunicationable userInfo)
 {
     if (nextLines.Count > 0)
     {
         if (!stepInfo.IsCountersign)
         {
             UserLog.create("非会签任务节点,开始执行下一步", "工作流", adminUser, this);
             //不是会签执行下一步
             DoWorkFlowConfim(nextLines.First());
         }
         else
         {
             //是会签
             //判断是否都已经审批过了 如果是 执行下一步
             if (!nowTaskUsers.Any(p => p.IsConfirm == false))
             {
                 UserLog.create("会签节点,全部用户完成审批,开始执行下一步", "工作流", adminUser, this);
                 DoWorkFlowConfim(nextLines.First());
             }
             else
             {
                 UserLog.create("会签节点,等待其他用户审批", "工作流", adminUser, this);
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// 管理员无条件直接终止工作流
 /// </summary>
 /// <param name="user"></param>
 /// <param name="condtion"></param>
 /// <returns></returns>
 public BaseWorkOrder WorkFlowTerminationForAdmin(ICommunicationable user, BaseWorkOrderUserConfirmReqeust condtion)
 {
     if (this.OrderStatus == WorkOrderStatus.执行中)
     {
         var result = DoWorkFlowTermination(user, condtion.Remark);
         //记录到日志
         UserLog.create("流程被管理员直接终止", "工作流", user, this);
         return(result);
     }
     else
     {
         throw new ValiDataException("只有执行中的工单才可进行终止操作");
     }
 }
コード例 #4
0
 /// <summary>
 /// 【具体业务根据需要重写】执行工作流终止操作前 - 默认为验证用户是否有审批权限
 /// </summary>
 /// <param name="condtion">审批请求</param>
 /// <param name="nowTaskUsers">当前步骤审批人列表</param>
 /// <param name="userInfo">当前审批人</param>
 /// <param name="stepInfo">步骤信息</param>
 /// <returns></returns>
 protected virtual bool DoWorkFlowTerminationBefore(BaseWorkOrderUserConfirmReqeust condtion, List <BaseWorkOrderTaskUserInfo> nowTaskUsers, ICommunicationable userInfo, WorkFlowDefStep stepInfo)
 {
     if (this.OrderStatus == WorkOrderStatus.执行中)
     {
         string userId = userInfo.getIdString();
         if (!nowTaskUsers.Select(p => p.UserId).Contains(userId))
         {
             throw new ValiDataException("您没有终止该流程的权限");
         }
         if (nowTaskUsers.Where(p => !p.IsConfirm).Select(p => p.UserId).Contains(userId))
         {
             return(true);
         }
         else
         {
             throw new ValiDataException("您已经审批过了,不能再终止该流程");
         }
     }
     else
     {
         throw new ValiDataException("当前工作流不是执行中的状态,不能终止");
     }
 }
コード例 #5
0
 /// <summary>
 /// 工作流终止(停止流程执行并设置为终止状态)
 /// </summary>
 public BaseWorkOrder WorkFlowTermination(ICommunicationable user, BaseWorkOrderUserConfirmReqeust condtion)
 {
     if (this.OrderStatus == WorkOrderStatus.执行中)
     {
         var    nowTaskUsers = GetTaskUsersByStepId(this.WorkFlowBookMarkId);
         var    stepInfo     = WorkFlowDefStep.GetInstance(this.WorkFlowBookMarkId);
         string userId       = user.getIdString();
         if (!DoWorkFlowTerminationBefore(condtion, nowTaskUsers, user, stepInfo))
         {
             throw new ValiDataException("该流程不能被终止");
         }
         var taskUserInfo = nowTaskUsers.Single(p => p.UserId == userId);
         var result       = DoWorkFlowTermination(user, condtion.Remark);
         //记录到日志
         UserLog.create(string.Format("流程被终止,原因:[{0}]", condtion.Remark), "工作流", user, this);
         //后续操作
         DoWorkFlowTerminationAfter(condtion, nowTaskUsers, taskUserInfo, stepInfo, user);
         return(result);
     }
     else
     {
         throw new ValiDataException("只有执行中的工单才可进行终止操作");
     }
 }
コード例 #6
0
 /// <summary>
 /// 【具体业务根据需要重写】执行工作流终止操作后 - 默认什么也没做
 /// </summary>
 /// <param name="condtion">审批请求</param>
 /// <param name="nowTaskUsers">步骤全部审批人</param>
 /// <param name="taskUserInfo">步骤当前审批人</param>
 /// <param name="stepInfo">步骤信息</param>
 /// <param name="userInfo">当前步骤审批人的其他信息</param>
 protected virtual void DoWorkFlowTerminationAfter(BaseWorkOrderUserConfirmReqeust condtion, List <BaseWorkOrderTaskUserInfo> nowTaskUsers, BaseWorkOrderTaskUserInfo taskUserInfo, WorkFlowDefStep stepInfo, ICommunicationable userInfo)
 {
     return;
 }