public bool MoveNext(WorkFlowParams param) { var doSuccessful = false; //先移动节点 var msg = _MoveNext(FindInstance(param.WorkFlowInstanceId), param.MoveParam, param.OperatorId, param.Reason, param.Relation); //移动结果 if (msg.SuccessfulAll) { try { //移动成功后执行业务代码 doSuccessful = param.DoIfSuccessful.Invoke(param.WorkFlowInstanceId); } catch (Exception ex) { doSuccessful = false; } if (!doSuccessful) { //业务代码执行失败应回滚实例到上一状态 throw new MoveFailByBllException("业务代码执行失败,请到数据库中手动将业务员代码回滚到上一状态"); } else { Db.SaveChanges();//提交工作流事务 } } return(doSuccessful); }
protected ActionResult MoveNext(string successTip, string failTip, object moveParam, Func <string, bool> doIfSuccessful, string reason = "未填写", RelationMoveParam relation = null) { var workFlowInstanceId = Request["id"]; //var uid = Request["uid"]; var param = new WorkFlowParams(workFlowInstanceId, DataContext.UserId, moveParam, doIfSuccessful, DataContext.UserId, reason, relation); return(WorkFlowService.MoveNext(param) ? Json(State.SuccessAutoClose, successTip) : Json(State.Fail, failTip));; }
public bool CreateAndMoveNext(WorkFlowParams param) { param.WorkFlowInstanceId = CreateInstance(param.WorkFlowId, param.Uid, param.UnitId).Instance.WorkFlowInstanceID; return(MoveNext(param)); }