Exemplo n.º 1
0
        /// <summary>
        /// 流转信息增加
        /// </summary>
        /// <param name="flowNodeAddViewModel"></param>
        /// <returns></returns>
        public int FlowNode_Add(FlowNodeAddViewModel flowNodeAddViewModel)
        {
            var node_Info = _IMapper.Map <FlowNodeAddViewModel, Flow_Node>(flowNodeAddViewModel);

            _IFlowNodeRepository.Add(node_Info);
            return(_IFlowNodeRepository.SaveChanges());
        }
Exemplo n.º 2
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);
        }