Exemplo n.º 1
0
        /// <summary>
        /// 更新上已流转记录中的状态  operate变为2 (已提交)
        /// </summary>
        /// <param name="flowInfoSearchViewModel"></param>
        /// <param name="nodeByrepair_Info"></param>
        /// <param name="currentNodeInfo"></param>
        private void Work_FlowNodeOperate_Update(FlowInfoSearchViewModel flowInfoSearchViewModel,
                                                 Flow_Node nodeByrepair_Info,
                                                 List <Flow_CurrentNodeAndNextNode> nodeDefine_Infos)
        {
            var flowInfo = _IMapper.Map <Flow_Node, FlowInfoSearchViewModel>(nodeByrepair_Info);
            List <Flow_Node> nodepre_Infos = _IFlowNodeRepository.SearchInfoByNodeWhere(flowInfo); //查询父节点操作信息

            if (nodepre_Infos[0].Parent_Flow_NodeDefineId == null)                                 //说明是开始节点,需要把当前用户设置为null
            {
                nodepre_Infos[0].User_InfoId = null;                                               //开始的当前处理人变为空,防止查出两条已办
            }
            nodepre_Infos[0].operate = "2";                                                        //把未提交状态(1),改为已提交状态(2)
            nodepre_Infos[0].EndTime = flowInfoSearchViewModel.StartTime;                          //用户提交时间,就是上一节点结束时间,是当前节点
            _IFlowNodeRepository.Update(nodepre_Infos[0]);
            if (nodeDefine_Infos.Count == 0)                                                       //说明是结束节点
            {
                nodeByrepair_Info.operate = "2";                                                   //把未提交状态(1),改为已提交状态(2)
                nodeByrepair_Info.EndTime = nodeByrepair_Info.StartTime;                           //结束节点的开始时间和结束时间一样,都为上一节点的提交时间
                _IFlowNodeRepository.Update(nodeByrepair_Info);
                _IFlowNodeRepository.SaveChanges();
                //把流程表结束时间赋上值
                var procedure_Info = _IFlowProcedureInfoRepository.GetInfoByProcedureId(flowInfoSearchViewModel.Flow_ProcedureId);
                procedure_Info.Endtime = nodeByrepair_Info.StartTime;
                procedure_Info.remark  = "2";//流程结束
                _IFlowProcedureInfoRepository.Update(procedure_Info);
                _IFlowProcedureInfoRepository.SaveChanges();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加流转信息(*******此方法适用于【跳转】******)
        /// </summary>
        /// <param name="flowInfoSearchViewModel"></param>
        /// <returns></returns>
        public FlowNodePreMiddlecs Work_FlowNodeJump_Add(FlowInfoSearchViewModel flowInfoSearchViewModel)
        {
            string RepairType = flowInfoSearchViewModel.RepairType;//表单类型,也就是相对应的角色类型
            //获取当前节点信息
            var currentNodeInfo = _IFlowNodeDefineInfoRepository
                                  .GetInfoByNodeDefineId(flowInfoSearchViewModel.Flow_NodeDefineId);

            //当前节点的下一节点信息
            List <Flow_CurrentNodeAndNextNode> nodeDefine_Infos = _IFlowNodeDefineInfoRepository
                                                                  .SearchNextNodeInfoByWhere(flowInfoSearchViewModel.Flow_NodeDefineId);
            var currentAllInfo = _IMapper.Map <Flow_NodeDefine, FlowNodePreMiddlecs>(currentNodeInfo);

            if (nodeDefine_Infos.Count != 0)//没有到结束节点
            {
                currentAllInfo.Flow_NextNodeDefineId = nodeDefine_Infos[0].Flow_NextNodeDefineId;
            }
            //请求信息存入流转信息表
            var nodeByrepair_Info = _IMapper.Map <FlowInfoSearchViewModel, Flow_Node>(flowInfoSearchViewModel);

            currentAllInfo = _IMapper.Map <Flow_Node, FlowNodePreMiddlecs>(nodeByrepair_Info, currentAllInfo);

            if (nodeByrepair_Info.Parent_Flow_NodeDefineId != null)//说明是非开始节点,包括(普通节点和结束节点)
            {
                Work_FlowNodeOperateJump_Update(flowInfoSearchViewModel, nodeByrepair_Info, nodeDefine_Infos);
            }
            if (nodeByrepair_Info.operate != "2")//说明不是结束节点
            {
                _IFlowNodeRepository.Add(nodeByrepair_Info);
            }
            _IFlowNodeRepository.SaveChanges();

            return(currentAllInfo);
        }
Exemplo n.º 3
0
        public ActionResult <FlowInfoSearchResModel> Manage_WorkFlowInfoJump_Add(FlowInfoSearchViewModel flowInfoSearchViewModel)
        {
            FlowNodePreMiddlecs flowNodePreMiddlecs = new FlowNodePreMiddlecs();

            flowNodePreMiddlecs = _IWorkFlowService.Work_FlowNodeJump_Add(flowInfoSearchViewModel);

            FlowInfoSearchResModel flowInfoSearchResModel = new FlowInfoSearchResModel();

            if (flowNodePreMiddlecs.NodeType != "结束类型")
            {
                flowInfoSearchResModel.IsSuccess                  = true;
                flowInfoSearchResModel.flowNodePreMiddlecs        = flowNodePreMiddlecs;
                flowInfoSearchResModel.baseViewModel.Message      = "增加流转信息成功,该流程还没有结束";
                flowInfoSearchResModel.baseViewModel.ResponseCode = 200;
                _ILogger.Information("增加流转信息成功,该流程还没有结束");
                return(Ok(flowInfoSearchResModel));
            }
            else
            {
                flowInfoSearchResModel.IsSuccess                  = false;
                flowInfoSearchResModel.flowNodePreMiddlecs        = null;
                flowInfoSearchResModel.baseViewModel.Message      = "所有流转信息增加完毕,本条流程已结束";
                flowInfoSearchResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("所有流转信息增加完毕,本条流程已结束");
                return(Ok(flowInfoSearchResModel));
            }
        }
Exemplo n.º 4
0
        //查询流转信息(重载查找父节点id)
        public List <Flow_Node> SearchInfoByNodeWhere(FlowInfoSearchViewModel fLowInfoSearchViewModel)
        {
            var predicate = SearchNodeWhere(fLowInfoSearchViewModel);
            var result    = DbSet.Where(predicate)
                            .OrderBy(o => o.StartTime).ToList();

            return(result);
        }
Exemplo n.º 5
0
        //根据条件查询流转(重载)
        private Expression <Func <Flow_Node, bool> > SearchNodeWhere(FlowInfoSearchViewModel fLowInfoSearchViewModel)
        {
            var predicate = WhereExtension.True <Flow_Node>();//初始化where表达式

            predicate = predicate.And(p => p.status.Contains(fLowInfoSearchViewModel.status));
            predicate = predicate.And(p => p.Flow_ProcedureId == fLowInfoSearchViewModel.Flow_ProcedureId);
            predicate = predicate.And(p => p.Repair_InfoId == fLowInfoSearchViewModel.Repair_InfoId);
            predicate = predicate.And(p => p.operate.Contains(fLowInfoSearchViewModel.operate));
            predicate = predicate.And(p => p.User_InfoId == fLowInfoSearchViewModel.User_InfoId);
            return(predicate);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 增加流转信息(*******此方法适用于任何节点,正常调用一次即可******)
        /// </summary>
        /// <param name="flowInfoSearchViewModel"></param>
        /// <returns></returns>
        public FlowNodePreMiddlecs Work_FlowNodeAll_Add(FlowInfoSearchViewModel flowInfoSearchViewModel)
        {
            string RepairType = flowInfoSearchViewModel.RepairType;//表单类型,也就是相对应的角色类型

            //当前节点的下一节点信息
            List <Flow_CurrentNodeAndNextNode> nodeDefine_Infos = _IFlowNodeDefineInfoRepository
                                                                  .SearchNextNodeInfoByWhere(flowInfoSearchViewModel.Flow_NodeDefineId);
            //获取当前节点信息
            var currentNodeInfo = _IFlowNodeDefineInfoRepository
                                  .GetInfoByNodeDefineId(flowInfoSearchViewModel.Flow_NodeDefineId);


            var currentAllInfo = _IMapper.Map <Flow_NodeDefine, FlowNodePreMiddlecs>(currentNodeInfo);

            if (nodeDefine_Infos.Count != 0)                                                      //没有到结束节点
            {
                currentAllInfo.Flow_NextNodeDefineId = nodeDefine_Infos[0].Flow_NextNodeDefineId; //下一节点Id,也就是拟文Id
            }
            //请求信息存入流转信息表
            var nodeByrepair_Info = _IMapper.Map <FlowInfoSearchViewModel, Flow_Node>(flowInfoSearchViewModel);

            currentAllInfo = _IMapper.Map <Flow_Node, FlowNodePreMiddlecs>(nodeByrepair_Info, currentAllInfo);

            if (nodeByrepair_Info.Parent_Flow_NodeDefineId != null)//说明是非开始节点,包括(普通节点和结束节点)
            {
                Work_FlowNodeOperate_Update(flowInfoSearchViewModel, nodeByrepair_Info, nodeDefine_Infos);
            }
            if (nodeByrepair_Info.operate != "2")//说明不是结束节点
            {
                _IFlowNodeRepository.Add(nodeByrepair_Info);
            }
            _IFlowNodeRepository.SaveChanges();
            if (nodeByrepair_Info.Parent_Flow_NodeDefineId == null) //说明是开始节点,需要再自动生成拟文和拟文下一步的流转信息
            {
                var FirstFlow = _IMapper.Map <FlowNodePreMiddlecs, FlowInfoSearchViewModel>(currentAllInfo, flowInfoSearchViewModel);
                currentAllInfo = Work_FlowNodeAll_Add(FirstFlow);//生成拟文流转记录
                //获得下一节点处理人id ,这里也就是管理员的 用户id
                RoleByNodeSearchSingleViewModel userLis = new RoleByNodeSearchSingleViewModel();
                userLis.Flow_NextNodeDefineId = currentAllInfo.Flow_NextNodeDefineId.Value; //下一节点Id
                userLis.RoleType = RepairType;                                              //表单的类型与角色类型必须一致
                List <UserSearchMiddlecs> frn = User_By_Node_Search(userLis);
                if (frn.Count != 1)
                {
                    return(null);
                }
                //生成管理员流转信息
                var NiWenFlow = _IMapper.Map <FlowNodePreMiddlecs, FlowInfoSearchViewModel>(currentAllInfo, flowInfoSearchViewModel);
                NiWenFlow.User_InfoId = frn[0].id;

                currentAllInfo = Work_FlowNodeAll_Add(NiWenFlow);//生成拟文下一节点流转记录,也就是管理员未办记录
            }
            return(currentAllInfo);
        }
Exemplo n.º 7
0
        public ActionResult <FlowInfoSearchResModel> Manage_WorkFlowInfo_Add(FlowInfoSearchViewModel flowInfoSearchViewModel)
        {
            FlowNodePreMiddlecs flowNodePreMiddlecs = new FlowNodePreMiddlecs();

            flowNodePreMiddlecs = _IWorkFlowService.Work_FlowNodeAll_Add(flowInfoSearchViewModel);

            FlowInfoSearchResModel flowInfoSearchResModel = new FlowInfoSearchResModel();

            if (flowNodePreMiddlecs == null)
            {
                flowInfoSearchResModel.IsSuccess                  = false;
                flowInfoSearchResModel.flowNodePreMiddlecs        = null;
                flowInfoSearchResModel.baseViewModel.Message      = "生产当前节点未办失败,当前节点的当前类型角色下配有多个人或没有配人,请检查当前类型的角色下的人";
                flowInfoSearchResModel.baseViewModel.ResponseCode = 400;
                _ILogger.Information("生产当前节点未办失败,当前节点的当前类型角色下配有多个人或没有配人,请检查当前类型的角色");
                return(BadRequest(flowInfoSearchResModel));
            }
            else if (flowNodePreMiddlecs.NodeType != "结束类型")
            {
                flowInfoSearchResModel.IsSuccess                  = true;
                flowInfoSearchResModel.flowNodePreMiddlecs        = flowNodePreMiddlecs;
                flowInfoSearchResModel.baseViewModel.Message      = "增加流转信息成功,该流程还没有结束";
                flowInfoSearchResModel.baseViewModel.ResponseCode = 200;
                _ILogger.Information("增加流转信息成功,该流程还没有结束");
                return(Ok(flowInfoSearchResModel));
            }
            else
            {
                flowInfoSearchResModel.IsSuccess                  = false;
                flowInfoSearchResModel.flowNodePreMiddlecs        = null;
                flowInfoSearchResModel.baseViewModel.Message      = "所有流转信息增加完毕,本条流程已结束";
                flowInfoSearchResModel.baseViewModel.ResponseCode = 200;
                _ILogger.Information("所有流转信息增加完毕,本条流程已结束");
                return(Ok(flowInfoSearchResModel));
            }
        }