public ActionResult ShowMyChecked() { var runEnum = (short)Heima8.OA.Model.Enum.WFStepEnum.UnProecess; var instanceEnum = (short)Heima8.OA.Model.Enum.WF_InstanceEnum.Processed; var steps = WF_StepService.GetEntities(s => s.StepStatus == runEnum && s.ProcessBy == LoginUser.ID).ToList(); var instanceIds = (from s in steps select s.WF_InstanceID).Distinct(); var data = WF_InstanceService.GetEntities(i => i.DelFlag == DeleteFlag.DelflagNormal && instanceIds.Contains(i.ID)).ToList(); return(View(data)); }
//显示待审批 public ActionResult ShowMyUnCheck() { var runEnum = (short)Heima8.OA.Model.Enum.WFStepEnum.UnProecess; var instanceEnum = (short)Heima8.OA.Model.Enum.WF_InstanceEnum.Processing; //拿到当前用户未处理的 步骤 var steps = WF_StepService.GetEntities(s => s.StepStatus == runEnum && s.ProcessBy == LoginUser.ID).ToList(); //通过我没有处理的步骤拿到流程的实例id var instanceIds = (from s in steps select s.WF_InstanceID).Distinct(); //流程实例的id拿到所有的流程。 var data = WF_InstanceService.GetEntities( i => i.DelFlag == DeleteFlag.DelflagNormal && instanceIds.Contains(i.ID) && i.Status == instanceEnum).ToList(); return(View(data)); }
/// <summary> /// 审批 /// </summary> /// <param name="stepId">当前审批步骤id</param> /// <param name="isPass">是否通过</param> /// <param name="Comment">审批意见</param> /// <param name="flowTo">流转到谁</param> /// <returns></returns> public ActionResult DoCheck(int stepId, bool isPass, string Comment, int flowTo) { //stepId:id, isPass: pass, Comment: $("#Comment").val() } //1、更新当前步骤 var step = WF_StepService.GetEntities(s => s.ID == stepId).FirstOrDefault(); step.ProcessResult = isPass ? "通过" : "不通过"; step.StepStatus = (short)Heima8.OA.Model.Enum.WFStepEnum.Processed; step.ProcessTime = DateTime.Now; step.PorcessComment = Comment; WF_StepService.Update(step); //初始化下一个步骤 WF_Step nextStep = new WF_Step(); nextStep.IsEndStep = false; nextStep.IsStartStep = false; nextStep.ProcessBy = flowTo;//下一个步骤处理人 nextStep.SubTime = DateTime.Now; nextStep.ProcessResult = string.Empty; nextStep.StepStatus = (short)Heima8.OA.Model.Enum.WFStepEnum.UnProecess; nextStep.StepName = string.Empty; nextStep.WF_InstanceID = step.WF_InstanceID; nextStep.ProcessTime = DateTime.Now; nextStep.PorcessComment = string.Empty; WF_StepService.Add(nextStep); //让书签继续往下执行。 var Value = isPass ? 1 : 0; var instance = GetWfInstance(step); var temp = GetWfTemp(instance); var activity = WorkflowFactory.GetActivity(temp.ActityType); Heima8.OA.Workflow.WorkflowApplicationHelper.ResumeBookMark( activity, step.WF_Instance.WFInstanceId, step.StepName, Value); return(Content("ok")); }