Ejemplo n.º 1
0
 /// <summary>
 /// 验证基本的输入参数
 /// </summary>
 /// <param name="returnInfo">返回信息</param>
 /// <param name="flowIn">流程输入</param>
 private void ValiBasicInParam(ReturnInfo <bool> returnInfo, FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn)
 {
     if (flowIn == null)
     {
         returnInfo.SetFailureMsg("流程输入不能为null");
         return;
     }
     if (flowIn.Flow == null)
     {
         returnInfo.SetFailureMsg("流程不能为null");
         return;
     }
     if (flowIn.Form == null)
     {
         returnInfo.SetFailureMsg("表单不能为null");
         return;
     }
     if (string.IsNullOrWhiteSpace(flowIn.Flow.WorkflowCode))
     {
         returnInfo.SetFailureMsg("请输入工作流编码");
         return;
     }
     if (flowIn.Flow.Id < 1 && string.IsNullOrWhiteSpace(flowIn.Flow.ApplyNo))
     {
         returnInfo.SetFailureMsg("请输入申请单号");
         return;
     }
     if (string.IsNullOrWhiteSpace(flowIn.Flow.Title))
     {
         returnInfo.SetFailureMsg("请输入标题");
         return;
     }
 }
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowAuditInfo> flowIn, FlowCensorshipInInfo findFlowCensorshipIn)
 {
     findFlowCensorshipIn.ActionType         = flowIn.Flow.ActionType;
     findFlowCensorshipIn.Idea               = flowIn.Flow.Idea;
     findFlowCensorshipIn.CurrWorkflowHandle = flowIn.Flow.WorkflowHandle;
     findFlowCensorshipIn.Workflow           = flowIn.Flow.WorkflowHandle.Workflow;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 验证数据库参数
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="workflow">工作流</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="currUser">当前用户</param>
        private void ValiDbParam(ReturnInfo <bool> returnInfo, FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn, out WorkflowInfo workflow, string connectionId = null, BasicUserInfo <int> currUser = null)
        {
            workflow = null;
            ReturnInfo <WorkflowDefineInfo> reWorkFlowConfig = WorkflowConfigReader.ReaderAllConfig(flowIn.Flow.WorkflowCode, connectionId, currUser);

            if (reWorkFlowConfig.Failure())
            {
                returnInfo.FromBasic(reWorkFlowConfig);
                return;
            }

            var user = UserTool <int> .GetCurrUser(currUser);

            if (flowIn.Flow.Id > 0)
            {
                var reInfo = WorkflowService.Find(flowIn.Flow.Id, connectionId, currUser);
                if (reInfo.Failure())
                {
                    returnInfo.FromBasic(reInfo);

                    return;
                }
                if (reInfo.Data == null)
                {
                    returnInfo.SetFailureMsg($"找不到工作流ID[{flowIn.Flow.Id}]的数据");

                    return;
                }

                if (reInfo.Data.CreaterId != user.Id)
                {
                    returnInfo.SetFailureMsg($"Sorry,此流程不是您创建的,无权限操作");

                    return;
                }

                workflow = reInfo.Data;

                flowIn.Flow.Id      = workflow.Id;
                flowIn.Flow.ApplyNo = workflow.ApplyNo;
            }
            else
            {
                ReturnInfo <bool> reInfo = WorkflowService.ExistsByApplyNo(flowIn.Flow.ApplyNo, connectionId, currUser);
                if (reInfo.Failure())
                {
                    returnInfo.FromBasic(reInfo);

                    return;
                }
                if (reInfo.Data)
                {
                    returnInfo.SetFailureMsg($"申请单号[{flowIn.Flow.ApplyNo}]已存在");

                    return;
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 /// <param name="currUser">当前用户</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowInitInfo <PersonTimeInfo> > flowIn, FlowCensorshipInInfo findFlowCensorshipIn, BasicUserInfo currUser = null)
 {
     base.AppendSetFindFlowCensorshipIn(flowIn, findFlowCensorshipIn, currUser);
     findFlowCensorshipIn.ActionType = ActionType.SAVE;
 }
        /// <summary>
        /// 验证流程输入
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="workflow">工作流</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>工作流定义</returns>
        protected override WorkflowDefineInfo ValiFlowIn(ReturnInfo <bool> returnInfo, FlowInInfo <FlowAuditInfo> flowIn, out WorkflowInfo workflow, string connectionId = null)
        {
            workflow = null;
            if (flowIn == null)
            {
                returnInfo.SetFailureMsg("流程输入不能为null");
                return(null);
            }
            if (flowIn.Flow == null)
            {
                returnInfo.SetFailureMsg("流程不能为null");
                return(null);
            }

            ReturnInfo <WorkflowHandleInfo> reHandle = WorkflowHandle.Find(flowIn.Flow.HandleId, connectionId);

            if (reHandle.Failure())
            {
                returnInfo.FromBasic(reHandle);
                return(null);
            }
            if (reHandle.Data == null)
            {
                returnInfo.SetFailureMsg("找不到工作流处理信息");
                return(null);
            }
            if (reHandle.Data.HandlerId != UserTool.CurrUser.Id)
            {
                returnInfo.SetFailureMsg("此处理流程不属于您审核");
                return(null);
            }
            if (reHandle.Data.HandleType == HandleTypeEnum.NOTIFY)
            {
                returnInfo.SetFailureMsg("您的处理流程是通知类型,不能审核");
                return(null);
            }
            if (reHandle.Data.HandleStatus == HandleStatusEnum.SENDED || reHandle.Data.HandleStatus == HandleStatusEnum.RETURNED)
            {
                returnInfo.SetFailureMsg("您的处理流程是已审核过,不能重复审核");
                return(null);
            }
            if (reHandle.Data.HandleStatus == HandleStatusEnum.EFFICACYED)
            {
                returnInfo.SetFailureMsg("您的处理流程已失效,不能审核");
                return(null);
            }

            ReturnInfo <WorkflowInfo> reWorkflow = WorkflowService.Find(reHandle.Data.WorkflowId);

            if (reWorkflow.Failure())
            {
                returnInfo.FromBasic(reWorkflow);
                return(null);
            }
            if (reWorkflow.Data == null)
            {
                returnInfo.SetFailureMsg("找不到工作流信息");
                return(null);
            }
            if (reWorkflow.Data.FlowStatus == FlowStatusEnum.DRAFT)
            {
                returnInfo.SetFailureMsg("此工作流是草稿状态不能审核");
                return(null);
            }
            if (reWorkflow.Data.FlowStatus == FlowStatusEnum.AUDIT_NOPASS || reWorkflow.Data.FlowStatus == FlowStatusEnum.AUDIT_PASS)
            {
                returnInfo.SetFailureMsg("此工作流已审核结束");
                return(null);
            }

            reHandle.Data.Workflow     = reWorkflow.Data;
            flowIn.Flow.WorkflowHandle = reHandle.Data;

            ReturnInfo <WorkflowDefineInfo> reWorkFlowConfig = WorkflowConfigReader.ReaderAllConfig(reWorkflow.Data.WorkflowDefineId, connectionId);

            if (reWorkFlowConfig.Failure())
            {
                returnInfo.FromBasic(reWorkFlowConfig);
                return(null);
            }

            return(reWorkFlowConfig.Data);
        }
        /// <summary>
        /// 执行核心
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="findFlowCensorshipOut">查找流程关卡输出</param>
        /// <param name="connectionId">连接ID</param>
        protected override void ExecCore(ReturnInfo <bool> returnInfo, FlowInInfo <FlowAuditInfo> flowIn,
                                         FlowCensorshipOutInfo findFlowCensorshipOut, string connectionId = null)
        {
            // 更新工作流状态
            WorkflowPersistence.UpdateFlowStatusAndCensorshipAndHandlerById(findFlowCensorshipOut.Workflow, connectionId);

            // 更新当前工作流处理状态
            WorkflowHandlePersistence.UpdateHandleStatusById(findFlowCensorshipOut.CurrConcreteCensorship.WorkflowHandles[0], connectionId);

            string actionStr = flowIn.Flow.ActionType == ActionType.SEND ? "送件" : "退件";

            if (findFlowCensorshipOut.NextConcreteCensorshipHandles.IsNullOrLength0())
            {
                returnInfo.SetSuccessMsg($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]已{actionStr},等待其他人处理");
                return;
            }
            else
            {
                WorkflowHandleInfo updateEf = new WorkflowHandleInfo()
                {
                    Id = flowIn.Flow.HandleId,
                    FlowCensorshipId   = flowIn.Flow.WorkflowHandle.FlowCensorshipId,
                    ConcreteConcreteId = flowIn.Flow.WorkflowHandle.ConcreteConcreteId,
                    WorkflowId         = flowIn.Flow.WorkflowHandle.WorkflowId
                };
                updateEf.SetModifyInfo();

                if (flowIn.Flow.ActionType == ActionType.SEND)
                {
                    WorkflowHandlePersistence.UpdateEfficacyedNotIdByWorkflowIdAndFlowCensorshipId(updateEf, connectionId);
                }
                else
                {
                    WorkflowHandlePersistence.UpdateEfficacyedNotIdByWorkflowId(updateEf, connectionId);
                }

                // 插入下一个处理者
                IList <WorkflowHandleInfo> handlers = new List <WorkflowHandleInfo>();
                foreach (var c in findFlowCensorshipOut.NextConcreteCensorshipHandles)
                {
                    foreach (var h in c.WorkflowHandles)
                    {
                        h.WorkflowId = findFlowCensorshipOut.Workflow.Id;
                        handlers.Add(h);
                    }
                }

                ReturnInfo <bool> reHandle = WorkflowHandle.Add(handlers, connectionId);
                if (reHandle.Failure())
                {
                    returnInfo.FromBasic(reHandle);
                    return;
                }
            }

            StringBuilder msg = new StringBuilder($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]");

            if (findFlowCensorshipOut.ActionType == ActionType.SEND)
            {
                msg.AppendFormat("已送到[{0}]", findFlowCensorshipOut.Workflow.CurrHandlers);
                if (findFlowCensorshipOut.IsNextEndCensorship())
                {
                    msg.Append(",审核通过,流程结束");
                }
                else
                {
                    msg.Append("审核");
                }
            }
            else
            {
                msg.AppendFormat("已退给[{0}]", findFlowCensorshipOut.Workflow.CurrHandlers);
                if (findFlowCensorshipOut.IsNextApplicantCensorship())
                {
                    msg.Append(",审核驳回,流程结束");
                }
                else
                {
                    msg.Append("审核");
                }
            }

            returnInfo.SetMsg(msg.ToString());
        }
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowInitInfo <PersonTimeInfo> > flowIn, FlowCensorshipInInfo findFlowCensorshipIn)
 {
     base.AppendSetFindFlowCensorshipIn(flowIn, findFlowCensorshipIn);
     findFlowCensorshipIn.ActionType = ActionType.SAVE;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 /// <param name="comData">通用数据</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn, FlowCensorshipInInfo findFlowCensorshipIn, CommonUseData comData = null)
 {
     base.AppendSetFindFlowCensorshipIn(flowIn, findFlowCensorshipIn, comData);
     findFlowCensorshipIn.ActionType = ActionType.SEND;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 转换为申请的具体表单信息
        /// </summary>
        /// <param name="flowCensorshipOut">流程关卡输出</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="conFlowIn">具体流程输入</param>
        /// <returns>具体表单信息</returns>
        private ConcreteFormInfoT ToApplyConcreteFormInfo(FlowCensorshipOutInfo flowCensorshipOut, object flowIn, ReturnInfo <bool> returnInfo, out FlowInInfo <FlowInitInfo <PersonTimeInfo> > conFlowIn)
        {
            conFlowIn = flowIn as FlowInInfo <FlowInitInfo <PersonTimeInfo> >;
            if (conFlowIn == null)
            {
                returnInfo.SetFailureMsg("流程输入不能转换为FlowInInfo<FlowApplyInfo<PersonTimeInfo>>");
                return(null);
            }
            ConcreteFormInfoT form = conFlowIn.Form as ConcreteFormInfoT;

            if (form == null)
            {
                returnInfo.SetFailureMsg($"表单不能转换为{typeof(ConcreteFormInfoT).Name}");
                return(null);
            }

            return(form);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 执行核心
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="findFlowCensorshipOut">查找流程关卡输出</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="currUser">当前用户</param>
        protected override void ExecCore(ReturnInfo <bool> returnInfo, FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn,
                                         FlowCensorshipOutInfo findFlowCensorshipOut, string connectionId = null, BasicUserInfo <int> currUser = null)
        {
            // 操作工作流
            ReturnInfo <bool> reWorkflow = WorkflowService.Set(findFlowCensorshipOut.Workflow, connectionId, currUser);

            if (reWorkflow.Failure())
            {
                returnInfo.FromBasic(reWorkflow);
                return;
            }
            if (flowIn.Flow.Id < 1)
            {
                flowIn.Flow.Id = findFlowCensorshipOut.Workflow.Id;
            }

            // 操作工作流处理
            var currHandle = findFlowCensorshipOut.CurrConcreteCensorship.WorkflowHandles[0];

            currHandle.WorkflowId = findFlowCensorshipOut.Workflow.Id;

            var existsHandleReturnInfo = WorkflowHandle.FindByWorkflowIdAndFlowCensorshipIdAndHandlerId(currHandle.WorkflowId, currHandle.FlowCensorshipId, currHandle.HandlerId, connectionId, currUser);

            if (existsHandleReturnInfo.Failure())
            {
                returnInfo.FromBasic(existsHandleReturnInfo);
                return;
            }

            var user = UserTool <int> .GetCurrUser(currUser);

            if (existsHandleReturnInfo.Data != null)
            {
                if (existsHandleReturnInfo.Data.HandlerId != user.Id)
                {
                    returnInfo.SetFailureMsg($"Sorry,此流程不是您处理的,无权限操作");

                    return;
                }

                currHandle.Id = existsHandleReturnInfo.Data.Id;
                currHandle.SetModifyInfo(currUser);
            }

            ReturnInfo <bool> reHandle = WorkflowHandle.Set(findFlowCensorshipOut.CurrConcreteCensorship.WorkflowHandles[0], connectionId, currUser);

            if (reHandle.Failure())
            {
                returnInfo.FromBasic(reHandle);
                return;
            }

            if (findFlowCensorshipOut.NextConcreteCensorshipHandles.IsNullOrLength0())
            {
                returnInfo.SetMsg($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]已保存为草稿");
                return;
            }

            IList <WorkflowHandleInfo> handlers = new List <WorkflowHandleInfo>();

            foreach (var c in findFlowCensorshipOut.NextConcreteCensorshipHandles)
            {
                foreach (var h in c.WorkflowHandles)
                {
                    h.WorkflowId = findFlowCensorshipOut.Workflow.Id;
                    handlers.Add(h);
                }
            }

            reHandle = WorkflowHandle.Add(handlers, connectionId, currUser);
            if (reHandle.Failure())
            {
                returnInfo.FromBasic(reHandle);
                return;
            }

            returnInfo.SetMsg($"申请单号[{findFlowCensorshipOut.Workflow.ApplyNo}]已送到[{findFlowCensorshipOut.Workflow.CurrHandlers}]审核");
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 /// <param name="currUser">当前用户</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn, FlowCensorshipInInfo findFlowCensorshipIn, BasicUserInfo <int> currUser = null)
 {
     findFlowCensorshipIn.ApplyNo = flowIn.Flow.ApplyNo;
     findFlowCensorshipIn.Title   = flowIn.Flow.Title;
     findFlowCensorshipIn.Idea    = flowIn.Flow.Idea;
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 验证流程输入
        /// </summary>
        /// <param name="returnInfo">返回信息</param>
        /// <param name="flowIn">流程输入</param>
        /// <param name="workflow">工作流</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="currUser">当前用户</param>
        /// <returns>工作流定义</returns>
        protected override WorkflowDefineInfo ValiFlowIn(ReturnInfo <bool> returnInfo, FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn, out WorkflowInfo workflow, string connectionId = null, BasicUserInfo <int> currUser = null)
        {
            workflow = null;
            ValiBasicInParam(returnInfo, flowIn);
            if (returnInfo.Failure())
            {
                return(null);
            }

            ReturnInfo <WorkflowDefineInfo> reWorkFlowConfig = WorkflowConfigReader.ReaderAllConfig(flowIn.Flow.WorkflowCode, connectionId, currUser);

            if (reWorkFlowConfig.Failure())
            {
                returnInfo.FromBasic(reWorkFlowConfig);
                return(null);
            }

            ValiDbParam(returnInfo, flowIn, out workflow, connectionId, currUser);
            if (returnInfo.Failure())
            {
                return(null);
            }

            return(reWorkFlowConfig.Data);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowInitInfo <PersonTimeInfo> > flowIn, FlowCensorshipInInfo findFlowCensorshipIn)
 {
     findFlowCensorshipIn.ApplyNo = flowIn.Flow.ApplyNo;
     findFlowCensorshipIn.Title   = flowIn.Flow.Title;
     findFlowCensorshipIn.Idea    = flowIn.Flow.Idea;
 }
 /// <summary>
 /// 追加设置查找流程关卡输入信息
 /// </summary>
 /// <param name="flowIn">流程输入</param>
 /// <param name="findFlowCensorshipIn">查找流程关卡输入信息</param>
 /// <param name="comData">通用数据</param>
 protected override void AppendSetFindFlowCensorshipIn(FlowInInfo <FlowInitInfo <PersonTimeInfo <int> > > flowIn, FlowCensorshipInInfo findFlowCensorshipIn, CommonUseData comData = null)
 {
     findFlowCensorshipIn.ApplyNo = flowIn.Flow.ApplyNo;
     findFlowCensorshipIn.Title   = flowIn.Flow.Title;
     findFlowCensorshipIn.Idea    = flowIn.Flow.Idea;
 }