/// <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(); } }
/// <summary> /// 流程增加 /// </summary> /// <param name="flowProcedureAddViewModel"></param> /// <returns></returns> public int Procedure_Add(FlowProcedureAddViewModel flowProcedureAddViewModel) { var procedure_Info = _IMapper.Map <FlowProcedureAddViewModel, Flow_Procedure>(flowProcedureAddViewModel); _IFlowProcedureInfoRepository.Add(procedure_Info); return(_IFlowProcedureInfoRepository.SaveChanges()); }
/// <summary> /// 添加报修表单 /// </summary> /// <param name="repairAddViewModel"></param> /// <returns>返回主键id</returns> public WorkFlowFistReturnIdList Repair_Add(RepairAddViewModel repairAddViewModel, int Flow_ProcedureDefineId) { //存入表单信息 var repair_Info = _IMapper.Map <RepairAddViewModel, Repair_Info>(repairAddViewModel); _IRepairInfoRepository.Add(repair_Info); _IRepairInfoRepository.SaveChanges(); //存入流程信息(只有在开始节点的时候才会存入一条数据) var flowProcedureAddViewModel = _IMapper.Map <Repair_Info, FlowProcedureAddViewModel>(repair_Info); var procedure_Info = _IMapper.Map <FlowProcedureAddViewModel, Flow_Procedure>(flowProcedureAddViewModel); procedure_Info.remark = "1";//流程开始 _IFlowProcedureInfoRepository.Add(procedure_Info); _IFlowProcedureInfoRepository.SaveChanges(); //通过流程定义Id去查开始节点的主键id var ProcedureDefine = _IFlowNodeDefineInfoRepository.GetInfoByProcedureDefineId(Flow_ProcedureDefineId); int FirstNodeId = ProcedureDefine.Id; //返回三个Id WorkFlowFistReturnIdList workFlowFistReturnIdList = new WorkFlowFistReturnIdList(); workFlowFistReturnIdList.Repair_InfoId = repair_Info.id; //表单主键Id workFlowFistReturnIdList.RepairType = repair_Info.RepairsType; //填写的类型与角色类相对应 workFlowFistReturnIdList.User_InfoId = repair_Info.User_InfoId; //填写表单的用户Id workFlowFistReturnIdList.Flow_ProcedureId = procedure_Info.Id; //流程Id workFlowFistReturnIdList.Flow_NodeDefineId = FirstNodeId; //该流程第一个节点Id return(workFlowFistReturnIdList); }