/// <summary> /// XML节点预定义跳转 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSkip_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = "WallwaOrder"; appRunner.UserID = "13"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); var nodeViewList = wfService.GetNextActivityTree(appRunner); if (nodeViewList != null && nodeViewList.Count() == 1) { var nodeView = nodeViewList[0]; if (nodeView.IsSkipTo == true) { //下一步执行人 PerformerList list = new PerformerList(); Performer p = new Performer("1", "admin");//下一步人ID,Name list.Add(p); Dictionary <String, PerformerList> dict = new Dictionary <String, PerformerList>(); dict.Add(nodeView.ActivityGUID, list); //nodeView.ID 下一步节点的标识ID appRunner.NextActivityPerformers = dict; var result = wfService.JumpProcess(appRunner); var msg = string.Format("流程跳转结果:{0}\r\n", result.Status); textBox1.Text += msg; } } }
private void btn综合部签字_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; //第一步任务承担者,登录后要找到自己的任务 appRunner.AppName = "officeIn"; appRunner.UserID = "3"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); var en = new TaskQuery { UserID = "3" }; IList <TaskViewEntity> taskViewList = wfService.GetReadyTasks(en); appRunner.TaskID = taskViewList[0].TaskID; PerformerList list = new PerformerList(); list.Add(new Performer("5", "user5")); NodeView nv = wfService.GetNextActivity(appRunner); Dictionary <String, PerformerList> dictPerformer = new Dictionary <String, PerformerList>(); dictPerformer.Add(nv.ActivityGUID, list); appRunner.NextActivityPerformers = dictPerformer; var result = wfService.RunProcessApp(appRunner); var msg = string.Format("流程运行结果:{0}\r\n{1}\r\n", result.Status, result.Message); tBoxResult.Text += msg; }
public void Update() { PerformerList performers = new PerformerList(); performers.Load(); Performer performer = performers.FirstOrDefault(c => c.FirstName == "SLTEST"); Performer retrievedPerformer = new Performer(); if (performer != null) { retrievedPerformer.Id = performer.Id; performer.FirstName = "SLTEST1"; //Act HttpClient client = InitializeClient(); //Serialize a question object that we're trying to insert string serializedPerformer = JsonConvert.SerializeObject(performer); var content = new StringContent(serializedPerformer); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PutAsync("Performer/" + performer.Id, content).Result; retrievedPerformer.LoadById(); } //Assert Assert.AreEqual(performer.FirstName, retrievedPerformer.FirstName); }
public void Insert() { //Setup Performer performer = new Performer { FirstName = "SLTEST", LastName = "SLTEST" }; PerformerList performers = new PerformerList(); performers.Load(); int originalCount = performers.Count(); //Act HttpClient client = InitializeClient(); //Serialize a performer object that we're trying to insert string serializedPerformer = JsonConvert.SerializeObject(performer); var content = new StringContent(serializedPerformer); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PostAsync("Performer", content).Result; //Assert performers.Clear(); performers.Load(); Assert.AreEqual(originalCount + 1, performers.Count); }
/// <summary> /// 退回流程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBackward_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = "WallwaOrder"; appRunner.UserID = "1"; appRunner.UserName = "******"; //下一步执行人 PerformerList list = new PerformerList(); Performer p = new Performer("13", "andun");//下一步人ID,Name list.Add(p); Dictionary <String, PerformerList> dict = new Dictionary <String, PerformerList>(); dict.Add("fc8c71c5-8786-450e-af27-9f6a9de8560f", list); //print activity:"fc8c71c5-8786-450e-af27-9f6a9de8560f"下一步节点的标识ID appRunner.NextActivityPerformers = dict; IWorkflowService wfService = new WorkflowService(); var result = wfService.JumpProcess(appRunner); var msg = string.Format("流程跳转回退结果:{0}\r\n", result.Status); textBox1.Text += msg; }
/// <summary> /// 插入任务数据 /// </summary> /// <param name="activityInstance"></param> /// <param name="performers"></param> /// <param name="wfLinqDataContext"></param> internal void Insert(ActivityInstanceEntity activityInstance, PerformerList performers, WfLogonUser logonUser, ISession session) { foreach (Performer performer in performers) { TaskEntity entity = new TaskEntity(); entity.AppName = activityInstance.AppName; entity.AppInstanceID = activityInstance.AppInstanceID; entity.ActivityInstanceGUID = activityInstance.ActivityInstanceGUID; entity.ProcessInstanceGUID = activityInstance.ProcessInstanceGUID; entity.ActivityGUID = activityInstance.ActivityGUID; entity.ActivityName = activityInstance.ActivityName; entity.ProcessGUID = activityInstance.ProcessGUID; entity.TaskType = (short)TaskTypeEnum.Manual; entity.AssignedToUserID = performer.UserID; entity.AssignedToUserName = performer.UserName; entity.TaskState = 1; //1-待办状态 entity.CreatedByUserID = logonUser.UserID; entity.CreatedByUserName = logonUser.UserName; entity.CreatedDateTime = System.DateTime.Now; entity.RecordStatusInvalid = 0; Insert(entity, session); } }
private void btn仓库签字_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; //第一步任务承担者,登录后要找到自己的任务 appRunner.AppName = "officeIn"; appRunner.UserID = "1"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); //外部变量条件 Dictionary <string, string> dictCondition = new Dictionary <string, string>(); dictCondition.Add("surplus", cBoxSurplus.Text); appRunner.Conditions = dictCondition; //动态获取下一跳转后的节点 NodeView nv = wfService.GetNextActivity(appRunner, dictCondition); //指定对象执行者 PerformerList list = new PerformerList(); list.Add(new Performer("3", "user3")); Dictionary <String, PerformerList> dictPerformer = new Dictionary <String, PerformerList>(); dictPerformer.Add(nv.ActivityGUID, list); appRunner.NextActivityPerformers = dictPerformer; var result = wfService.RunProcessApp(appRunner); var msg = string.Format("流程运行结果:{0}\r\n{1}\r\n", result.Status, result.Message); tBoxResult.Text += msg; }
// GET: api/Performer public IEnumerable <Performer> Get() { PerformerList performers = new PerformerList(); performers.Load(); return(performers); }
private void btn仓库签字_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; //第一步任务承担者,登录后要找到自己的任务 appRunner.AppName = "officeIn"; appRunner.UserID = "1"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); //外部变量条件 Dictionary<string, string> dictCondition = new Dictionary<string, string>(); dictCondition.Add("surplus", cBoxSurplus.Text); appRunner.Conditions = dictCondition; //动态获取下一跳转后的节点 NodeView nv = wfService.GetNextActivity(appRunner, dictCondition); //指定对象执行者 PerformerList list = new PerformerList(); list.Add(new Performer("3", "user3")); Dictionary<String, PerformerList> dictPerformer = new Dictionary<String, PerformerList>(); dictPerformer.Add(nv.ActivityGUID, list); appRunner.NextActivityPerformers = dictPerformer; var result = wfService.RunProcessApp(appRunner); var msg = string.Format("流程运行结果:{0}\r\n{1}\r\n", result.Status, result.Message); tBoxResult.Text += msg; }
public void UpdateTest() { //Load up Guids PerformerList performers = new PerformerList(); Performer performer = new Performer(); performers.Load(); performer = performers.FirstOrDefault(p => p.FirstName == "Hunter"); GroupList groups = new GroupList(); Group group = new Group(); groups.Load(); group = groups.FirstOrDefault(c => c.Name == "Jazz Ensemble"); InstrumentList instruments = new InstrumentList(); Instrument instrument = new Instrument(); instruments.Load(); instrument = instruments.FirstOrDefault(c => c.Description == "Euphonium"); GroupMember groupMember = new GroupMember(); GroupMemberList groupMembers = new GroupMemberList(); groupMembers.Load(); groupMember = groupMembers.FirstOrDefault(p => p.GroupId == group.Id && p.PerformerId == performer.Id); groupMember.StartDate = Convert.ToDateTime("04/24/3000"); groupMember.EndDate = Convert.ToDateTime("04/25/3000"); groupMember.Instrument = instrument.Id; int results = groupMember.Update(); Assert.IsTrue(results == 1); }
public void LoadTest() { PerformerList performers = new PerformerList(); performers.Load(); Assert.AreEqual(7, performers.Count); }
/// <summary> /// 下一步活动 /// 内部测试时用到此方法 /// 特别注意:正式生产环境,不要使用该方法 /// </summary> /// <param name="userID">用户ID</param> /// <param name="userName">用户名称</param> /// <returns>服务类</returns> public IWorkflowService NextStepInt(string userID, string userName) { var performerList = new PerformerList(); performerList.Add(new Performer(userID, userName)); return(NextStepInt(performerList)); }
/// <summary> /// 获取审批人通过动态角色 /// </summary> /// <param name="roleId">动态角色</param> /// <param name="colName">绑定列</param> /// <param name="bizData">业务数据</param> /// <returns></returns> private PerformerList GetPerformerByDynRole(string roleId, string colName, IDictionary <string, object> bizData) { PerformerList plist = new PerformerList(); DynamicParameters param = new DynamicParameters(); param.Add("RoleUid", roleId); IEnumerable <FapBizDynRole> bizDynRole = _dataAccessor.QueryWhere <FapBizDynRole>("Fid=@RoleUid", param); foreach (var item in bizDynRole) { string sql = item.CustomSql; if (string.IsNullOrWhiteSpace(sql)) { continue; } if (sql.Contains("{申请人}")) //申请人 { if (bizData.TryGetValue("AppEmpUid", out object appEmpUid)) { sql = sql.Replace("{申请人}", appEmpUid?.ToString()); } else { sql = sql.Replace("{申请人}", "未知"); } } //这个要去掉,存在代理人的情况下 无法确定处理人 //if (sql.Contains("{处理人}")) //处理人 //{ // sql = sql.Replace("{处理人}", _session.EmpUid); //} if (sql.Contains("{指定字段}")) //指定字段 { if (bizData.TryGetValue(colName, out object colValue)) { sql = sql.Replace("{指定字段}", colValue?.ToString()); } else { sql = sql.Replace("{指定字段}", "未知"); } } if (sql.IsSafeSQL()) { IEnumerable <Employee> list = _dataAccessor.Query <Employee>("SELECT Fid,EmpName FROM Employee where Fid IN (" + sql + ")"); foreach (var employee in list) { plist.Add(new Performer { UserId = employee.Fid, UserName = employee.EmpName }); } } } return(plist); }
/// <summary> /// 插入任务数据 /// </summary> /// <param name="activityInstance"></param> /// <param name="performers"></param> /// <param name="wfLinqDataContext"></param> internal void Insert(ActivityInstanceEntity activityInstance, PerformerList performers, WfAppRunner runner, IDbSession session) { foreach (Performer performer in performers) { Insert(activityInstance, performer, runner, session); } }
public async Task GetPerformers() { var performerList = await _performerService.Get <IEnumerable <Performer> >(null, "GetPerformers"); PerformerList.Clear(); foreach (var item in performerList) { PerformerList.Add(item); } }
internal static IDictionary<string, PerformerList> CreateNextActivityPerformers(string activityGUID, string userID, string userName) { var performerList = new PerformerList(); performerList.Add(new Performer(userID, userName)); IDictionary<string, PerformerList> nextActivityPerformers = new Dictionary<string, PerformerList>(); nextActivityPerformers.Add(activityGUID, performerList); return nextActivityPerformers; }
/// <summary> /// 复制多实例子节点数据 /// </summary> /// <param name="plist">执行人员列表</param> /// <param name="mainActivityInstance">主节点</param> /// <param name="session">数据会话</param> private void CloneChildNodeOfMI(PerformerList plist, ActivityInstanceEntity mainActivityInstance, IDbSession session) { //查询已有的子节点列表 var childNodeListOfMI = base.ActivityInstanceManager.GetValidActivityInstanceListOfMI(mainActivityInstance.ID, session); //创建活动实例 ActivityInstanceEntity entity = new ActivityInstanceEntity(); for (short i = 0; i < plist.Count; i++) { var userID = plist[i].UserID; var userName = plist[i].UserName; var isTaskExisted = IsTaskExisted(childNodeListOfMI, userID); if (isTaskExisted == true) { //如果活动或者任务已经存在,则不用创建新活动和任务 continue; } //根据主节点来复制子节点数据 entity = ActivityInstanceManager.CreateActivityInstanceObject(mainActivityInstance); entity.AssignedToUserIDs = userID; entity.AssignedToUserNames = userName; entity.MIHostActivityInstanceID = mainActivityInstance.ID; //并行串行下,多实例子节点的执行顺序设置 if (mainActivityInstance.MergeType == (short)MergeTypeEnum.Sequence) { entity.CompleteOrder = (short)(i + 1); } else if (mainActivityInstance.MergeType == (short)MergeTypeEnum.Parallel) { entity.CompleteOrder = -1; //并行模式下CompleteOrder的优先级一样,所以置为 -1 } //如果是串行会签,只有第一个节点处于运行状态,其它节点挂起 if ((i > 0) && (mainActivityInstance.MergeType.Value == (short)MergeTypeEnum.Sequence)) { entity.ActivityState = (short)ActivityStateEnum.Suspended; } //插入活动实例数据,并返回活动实例ID entity.ID = ActivityInstanceManager.Insert(entity, session); //插入任务数据 base.TaskManager.Insert(entity, plist[i], base.ActivityForwardContext.ActivityResource.AppRunner, session); } }
/// <summary> /// 下一步活动 /// </summary> /// <param name="activityGUID">活动节点GUID</param> /// <param name="performerList">执行用户列表</param> /// <returns>服务类</returns> public IWorkflowService NextStep(string activityGUID, PerformerList performerList) { if (performerList != null && performerList.Count() > 0) { _wfAppRunner.NextActivityPerformers.Add(activityGUID, performerList); } else { throw new ApplicationException("下一步办理用户列表不能为空!"); } return(this); }
/// <summary> /// 下一步活动 /// </summary> /// <param name="activityGUID">活动节点GUID</param> /// <param name="performerList">执行用户列表</param> /// <returns>服务类</returns> public IWorkflowService NextStep(string activityGUID, PerformerList performerList) { if (performerList != null && performerList.Count() > 0) { _wfAppRunner.NextActivityPerformers.Add(activityGUID, performerList); } else { throw new ApplicationException(LocalizeHelper.GetEngineMessage("workflowservice.nextstep.error")); } return(this); }
public void DeleteTest() { Performer performer = new Performer(); PerformerList performers = new PerformerList(); performers.Load(); performer = performers.FirstOrDefault(c => c.FirstName == "BL Test"); int results = performer.Delete(); Assert.IsTrue(results == 1); }
/// <summary> /// 给执行者生成任务 /// </summary> /// <param name="sendbackOperation">退回类型</param> /// <param name="performerList"></param> /// <param name="session">会话</param> private void DistributeEachPerformerTask(SendBackOperation sendbackOperation, PerformerList performerList, IDbSession session) { foreach (var performer in performerList) { //执行退回方法 var nodeSendBack = NodeSendBackFactory.CreateNodeReverter(sendbackOperation, session); sendbackOperation.BackwardToTaskPerformer = performer; nodeSendBack.Execute(); } }
public ResponseResult <IDictionary <Guid, PerformerList> > GetNextActivityPerformers() { var performers = new PerformerList(); performers.Add(new Performer("10", "Long")); IDictionary <Guid, PerformerList> nexts = new Dictionary <Guid, PerformerList>(); nexts[Guid.Parse("10f7481a-ad1a-40f6-aeaa-8d32ceb1fcab")] = performers; return(ResponseResult <IDictionary <Guid, PerformerList> > .Success(nexts)); }
internal static IDictionary <string, PerformerList> CreateNextActivityPerformers(string activityGUID, string userID, string userName) { var performerList = new PerformerList(); performerList.Add(new Performer(userID, userName)); IDictionary <string, PerformerList> nextActivityPerformers = new Dictionary <string, PerformerList>(); nextActivityPerformers.Add(activityGUID, performerList); return(nextActivityPerformers); }
/// <summary> /// 生成办理人名称的字符串列表 /// </summary> /// <param name="performerList">操作者列表</param> /// <returns>ID字符串列表</returns> protected string GenerateActivityAssignedUserNames(PerformerList performerList) { StringBuilder strBuilder = new StringBuilder(1024); foreach (var performer in performerList) { if (strBuilder.ToString() != "") { strBuilder.Append(","); } strBuilder.Append(performer.UserName); } return(strBuilder.ToString()); }
/// <summary> /// 获取任务办理人列表 /// </summary> /// <param name="processInstanceID"></param> /// <param name="roles"></param> /// <returns></returns> public PerformerList GetPerformerList(int processInstanceID, List <Role> roles) { PerformerList performers = null; //获取流程发起人信息,在xml定义中有role变量:-1 if (roles.Count == 1 && roles[0].RoleCode == "-1") { IWorkflowService service = new WorkflowService(); Performer initiator = service.GetProcessInitiator(processInstanceID); performers = new PerformerList(); performers.Add(initiator); } return(performers); }
/// <summary> /// 获取节点上的执行者列表 /// </summary> /// <param name="nextNode"></param> /// <returns></returns> public PerformerList GetPerformerList(NodeView nextNode) { var roleIDs = nextNode.Roles.Select(x => x.ID).ToArray(); var userList = ResourceService.GetUserListByRoles(roleIDs); var performerList = new PerformerList(); foreach (var user in userList) { var performer = new Performer(user.UserID.ToString(), user.UserName); performerList.Add(performer); } return(performerList); }
/// <summary> /// 获取任务办理人列表 /// </summary> /// <param name="processInstanceID"></param> /// <param name="roles"></param> /// <returns></returns> public PerformerList GetPerformerList(int processInstanceID, List<Role> roles) { PerformerList performers = null; //获取流程发起人信息,在xml定义中有role变量:-1 if (roles.Count == 1 && roles[0].RoleCode == "-1") { IWorkflowService service = new WorkflowService(); Performer initiator = service.GetProcessInitiator(processInstanceID); performers = new PerformerList(); performers.Add(initiator); } return performers; }
/// <summary> /// 复制并行分支多实例节点数据 /// </summary> /// <param name="plist">执行人员列表</param> /// <param name="transitionGUID">转移GUID</param> /// <param name="gatewayActivityInstance">网关活动实例</param> /// <param name="toActivityInstance">多实例分支节点</param> /// <param name="session">数据会话</param> private void CloneChildNodeOfAndSplitMI(PerformerList plist, string transitionGUID, ActivityInstanceEntity gatewayActivityInstance, ActivityInstanceEntity toActivityInstance, IDbSession session) { //查询已有的子节点列表 var childNodeListOfAndSplitMI = base.ActivityInstanceManager.GetValidSplitedActivityInstanceList(gatewayActivityInstance.ProcessInstanceID, gatewayActivityInstance.ID, session); //创建活动实例 ActivityInstanceEntity newChildInstance = new ActivityInstanceEntity(); for (short i = 0; i < plist.Count; i++) { var userID = plist[i].UserID; var userName = plist[i].UserName; var isTaskExisted = IsTaskExisted(childNodeListOfAndSplitMI, userID); if (isTaskExisted == true) { //如果活动或者任务已经存在,则不用创建新活动和任务 continue; } newChildInstance = ActivityInstanceManager.CreateActivityInstanceObject(toActivityInstance); newChildInstance.AssignedToUserIDs = userID; newChildInstance.AssignedToUserNames = userName; //插入活动实例数据,并返回活动实例ID newChildInstance.ID = ActivityInstanceManager.Insert(newChildInstance, session); //插入转移数据 base.InsertTransitionInstance(base.ActivityForwardContext.ProcessInstance, transitionGUID, gatewayActivityInstance, newChildInstance, TransitionTypeEnum.Forward, TransitionFlyingTypeEnum.NotFlying, base.ActivityForwardContext.ActivityResource.AppRunner, session); //插入任务数据 base.TaskManager.Insert(newChildInstance, plist[i], base.ActivityForwardContext.ActivityResource.AppRunner, session); } }
public void LoadById() { Performer performer = new Performer(); PerformerList performers = new PerformerList(); performers.Load(); performer = performers.FirstOrDefault(c => c.FirstName == "BL Test"); Performer newPerformer = new Performer { Id = performer.Id }; newPerformer.LoadById(); Assert.AreEqual(performer.FirstName, newPerformer.FirstName); }
/// <summary> /// 下一步活动 /// 内部测试时用到此方法 /// 特别注意:正式生产环境,不要使用该方法 /// </summary> /// <param name="performerList">执行用户列表</param> /// <returns>服务类</returns> public IWorkflowService NextStepInt(PerformerList performerList) { var nextStep = new Dictionary <string, PerformerList>(); var nodeList = GetNextActivityTree(_wfAppRunner.TaskID.Value); foreach (var node in nodeList) { if (node.ActivityType == ActivityTypeEnum.TaskNode) { nextStep.Add(node.ActivityGUID, performerList); } } _wfAppRunner.NextActivityPerformers = nextStep; return(this); }
/// <summary> /// 子流程启动 /// </summary> /// <param name="runner">运行者</param> /// <param name="parentProcessInstance">父流程</param> /// <param name="subProcessNode">子流程节点</param> /// <param name="performerList">执行者列表</param> /// <param name="session">数据库会话</param> /// <param name="result">运行结果</param> /// <returns>运行时管理器</returns> public static WfRuntimeManager CreateRuntimeInstanceStartupSub(WfAppRunner runner, ProcessInstanceEntity parentProcessInstance, SubProcessNode subProcessNode, PerformerList performerList, IDbSession session, ref WfExecutedResult result) { //检查流程是否可以被启动 var rmins = new WfRuntimeManagerStartupSub(); rmins.WfExecutedResult = result = new WfExecutedResult(); var pim = new ProcessInstanceManager(); ProcessInstanceEntity processInstance = pim.GetProcessInstanceCurrent(session.Connection, runner.AppInstanceID, subProcessNode.SubProcessGUID, session.Transaction); //不能同时启动多个主流程 if (processInstance != null && processInstance.ParentProcessInstanceID == null && processInstance.ProcessState == (short)ProcessStateEnum.Running) { result.Status = WfExecutedStatus.Exception; result.ExceptionType = WfExceptionType.Started_IsRunningAlready; result.Message = LocalizeHelper.GetEngineMessage("wfruntimemanagerfactory.CreateRuntimeInstanceStartup.error"); return(rmins); } //processInstance 为空,此时继续执行启动操作 rmins.AppRunner = runner; rmins.ParentProcessInstance = parentProcessInstance; rmins.InvokedSubProcessNode = subProcessNode; //获取流程第一个可办理节点 rmins.ProcessModel = ProcessModelFactory.Create(runner.ProcessGUID, runner.Version); var startActivity = rmins.ProcessModel.GetStartActivity(); var firstActivity = rmins.ProcessModel.GetFirstActivity(); //子流程自动获取第一个办理节点上的人员列表 rmins.AppRunner.NextActivityPerformers = ActivityResource.CreateNextActivityPerformers(firstActivity.ActivityGUID, performerList); rmins.ActivityResource = new ActivityResource(runner, rmins.AppRunner.NextActivityPerformers); return(rmins); }
/// <summary> /// 由节点分配的人员信息生成PerformerList数据结构 /// </summary> /// <param name="activityInstance">活动实例</param> /// <returns>人员列表</returns> protected PerformerList AntiGenerateActivityPerformerList(ActivityInstanceEntity activityInstance) { var performerList = new PerformerList(); if (!string.IsNullOrEmpty(activityInstance.AssignedToUserIDs) && !string.IsNullOrEmpty(activityInstance.AssignedToUserNames)) { var assignedToUserIDs = activityInstance.AssignedToUserIDs.Split(','); var assignedToUserNames = activityInstance.AssignedToUserNames.Split(','); for (var i = 0; i < assignedToUserIDs.Count(); i++) { performerList.Add(new Performer(assignedToUserIDs[i], assignedToUserNames[i])); } } return(performerList); }
/// <summary> /// 一个流程的完整测试(开始 -> 运行 -> 撤销 -> 运行 -> 退回 -> 运行 -> 结束 -> 返签 -> 运行 -> 结束) /// </summary> /// <param name="initiator"></param> /// <returns></returns> public WfExecutedResult StartupRunningEnd(WfAppRunner initiator) { //流程开始->业务员提交 StartProcess(initiator); //业务员提交->板房签字 var banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f"; PerformerList pList = new PerformerList(); pList.Add(new Performer(20, "Zhang")); initiator.NextActivityPerformers = new Dictionary <Guid, PerformerList>(); initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList); RunProcessApp(initiator); //板房签字->业务员签字 //登录用户身份 initiator.UserID = 20; initiator.UserName = "******"; var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745"; pList.Clear(); pList.Add(new Performer(10, "Long")); initiator.NextActivityPerformers.Clear(); initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList); RunProcessApp(initiator); //业务员签字->结束 //登录用户身份 initiator.UserID = 10; initiator.UserName = "******"; var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de"; pList.Clear(); pList.Add(new Performer(10, "Long")); initiator.NextActivityPerformers.Clear(); initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList); RunProcessApp(initiator); return(_wfExecutedResult); }
private void btn综合部签字_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; //第一步任务承担者,登录后要找到自己的任务 appRunner.AppName = "officeIn"; appRunner.UserID = "3"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); PerformerList list = new PerformerList(); list.Add(new Performer("4", "user4")); NodeView nv = wfService.GetNextActivity(appRunner); Dictionary<String, PerformerList> dictPerformer = new Dictionary<String, PerformerList>(); dictPerformer.Add(nv.ActivityGUID, list); appRunner.NextActivityPerformers = dictPerformer; var result = wfService.RunProcessApp(appRunner); var msg = string.Format("流程运行结果:{0}\r\n{1}\r\n", result.Status, result.Message); tBoxResult.Text += msg; }
/// <summary> /// 退回流程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBackward_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = "WallwaOrder"; appRunner.UserID = "1"; appRunner.UserName = "******"; //下一步执行人 PerformerList list = new PerformerList(); Performer p = new Performer("13", "andun");//下一步人ID,Name list.Add(p); Dictionary<String, PerformerList> dict = new Dictionary<String, PerformerList>(); dict.Add("fc8c71c5-8786-450e-af27-9f6a9de8560f", list); //print activity:"fc8c71c5-8786-450e-af27-9f6a9de8560f"下一步节点的标识ID appRunner.NextActivityPerformers = dict; IWorkflowService wfService = new WorkflowService(); var result = wfService.JumpProcess(appRunner); var msg = string.Format("流程跳转回退结果:{0}\r\n", result.Status); textBox1.Text += msg; }
public async Task<ActionResult> Approval(string type = "agree", string processGUID = "", int instanceId = 0, double days = 0) { var resolveRequest = HttpContext.Request; resolveRequest.InputStream.Seek(0, System.IO.SeekOrigin.Begin); string jsonString = new System.IO.StreamReader(resolveRequest.InputStream).ReadToEnd(); try { IWorkflowService service = new WorkflowService(); WfAppRunner runner = new WfAppRunner(); runner.AppInstanceID = instanceId.ToString(); runner.ProcessGUID = processGUID; runner.UserID = User.Identity.GetUserId(); IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition("days-" + days)); var leave = JsonConvert.DeserializeObject<LeaveEntity>(jsonString); leave.ID = instanceId; //调用流程 WfAppRunner initiator = new WfAppRunner(); initiator.AppName = "请假流程"; initiator.AppInstanceID = instanceId.ToString(); initiator.ProcessGUID = processGUID; initiator.UserID = User.Identity.GetUserId(); initiator.UserName = User.Identity.GetUserName(); initiator.Conditions = GetCondition(string.Format("days-{0}", days)); //后续节点不用传入条件表达式 //获取下一步审批人信息 //下一步角色ID审批者 PerformerList pList = new PerformerList(); if (NodeViewList[0].Roles.Count > 0) { string outerId = NodeViewList[0].Roles[0].ID.ToString(); //这里只取第一个审批者,WebDemo 是弹窗形式选择 //审批用户id IEnumerable<int> userId = RoleManager.FindById(Convert.ToInt32(outerId)).Users.Select(t => t.UserId); ApplicationUser user = await UserManager.FindByIdAsync(Convert.ToInt32(userId.ToList()[0])); //送往下一步 pList.Add(new Performer(user.Id.ToString(), user.RealName)); } initiator.NextActivityPerformers = new Dictionary<String, PerformerList>(); initiator.NextActivityPerformers.Add(NodeViewList[0].ActivityGUID, pList); WfExecutedResult runAppResult = service.RunProcessApp(initiator); if (runAppResult.Status != WfExecutedStatus.Success) { } ProcessEntity processEntity = service.GetProcessById(processGUID); if (processEntity != null) { ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(instanceId); if (activityInstanceEntity != null) { //CurrentActivityText = activityInstanceEntity.ActivityName; } } new WorkFlowManager().UpdateHrsLeave(leave); } catch (Exception ex) { return Json(new { success = false, message = ex.Message }); } return Json(new { success = true, message = "执行成功" }); }
public async Task<ActionResult> Add(LeaveViewModel leave) { string processGUID = leave.ProcessGUID; //验证不通过,重新填写表单 if (!ModelState.IsValid) { return View(); } IWorkflowService service = new WorkflowService(); //流程开始第一步 ActivityEntity firstActivity = service.GetFirstActivity(leave.ProcessGUID); //该处较上一版本有变化,上一版本为GUID类型 string firstActivityGUID = firstActivity.ActivityGUID; IList<NodeView> nextActivity = service.GetNextActivity(leave.ProcessGUID, firstActivityGUID, GetCondition("days-" + leave.Days)); //表示有下一位审批者 if (nextActivity.Count() > 0) { //下一步角色ID审批者 string outerId = nextActivity[0].Roles[0].ID.ToString(); //这里只取第一个审批者,WebDemo 是弹窗形式选择 //审批用户id IEnumerable<int> userId = RoleManager.FindById(Convert.ToInt32(outerId)).Users.Select(t => t.UserId); ApplicationUser user = await UserManager.FindByIdAsync(Convert.ToInt32(userId.ToList()[0])); //提交请假信息 LeaveEntity leaveE = new LeaveEntity() { FromDate = leave.BeginTime, ToDate = leave.EndTime, Days = leave.Days, LeaveType = leave.LeaveType, CurrentActivityText = "", Status = 0, CreatedUserID = Convert.ToInt32(User.Identity.GetUserId()), CreatedUserName = User.Identity.Name, CreatedDate = DateTime.Now }; HrsLeaveResult result = new WorkFlowManager().Insert(leaveE); if (result.Successed) { WfAppRunner initiator = new WfAppRunner(); initiator.AppName = "请假流程"; initiator.AppInstanceID = result.ResultIdentities.ToString(); initiator.ProcessGUID = processGUID; initiator.UserID = User.Identity.GetUserId(); initiator.UserName = User.Identity.Name; initiator.Conditions = GetCondition(string.Format("days-{0}", leave.Days)); WfExecutedResult startedResult = service.StartProcess(initiator); if (startedResult.Status != WfExecutedStatus.Success) { //给出提示 } //送往下一步 PerformerList pList = new PerformerList(); //这里使用真实姓名代替 pList.Add(new Performer(user.Id.ToString(), user.RealName)); initiator.NextActivityPerformers = new Dictionary<String, PerformerList>(); initiator.NextActivityPerformers.Add(nextActivity[0].ActivityGUID, pList); WfExecutedResult runAppResult = service.RunProcessApp(initiator); if (runAppResult.Status != WfExecutedStatus.Success) { this.Content("<script>alert('" + runAppResult.Message + "');</script>"); } //保存业务数据 BizAppFlowEntity AppFlowEntity = new BizAppFlowEntity(); AppFlowEntity.AppName = "流程发起"; AppFlowEntity.AppInstanceID = result.ResultIdentities.ToString(); AppFlowEntity.ActivityName = "流程发起"; AppFlowEntity.Remark = string.Format("申请人:{0}-{1}", User.Identity.GetUserId(), User.Identity.Name); AppFlowEntity.ChangedTime = DateTime.Now; AppFlowEntity.ChangedUserID = User.Identity.GetUserId(); AppFlowEntity.ChangedUserName = User.Identity.Name; HrsLeaveResult resultBiz = new WorkFlowManager().Insert(AppFlowEntity); if (resultBiz.Successed) { //给出前台提示 this.Content("", "<script>alert('流程发起成功');</script>"); } } } else { //显示前台错误,人事人员审批失败 ModelState.AddModelError("Human", "该用户暂时不可提交审批,未查询到该用户的下一位审批者"); return View(); } return RedirectToAction("MySlickflow", "Slickflow"); }
/// <summary> /// 由节点分配的人员信息生成PerformerList数据结构 /// </summary> /// <param name="activityInstance"></param> /// <returns></returns> protected PerformerList AntiGenerateActivityPerformerList(ActivityInstanceEntity activityInstance) { var performerList = new PerformerList(); if (!string.IsNullOrEmpty(activityInstance.AssignedToUserIDs) && !string.IsNullOrEmpty(activityInstance.AssignedToUserNames)) { var assignedToUserIDs = activityInstance.AssignedToUserIDs.Split(','); var assignedToUserNames = activityInstance.AssignedToUserNames.Split(','); for (var i = 0; i < assignedToUserIDs.Count(); i++) { performerList.Add(new Performer(assignedToUserIDs[i], assignedToUserNames[i])); } } return performerList; }
public void StartupRunEnd() { IDbConnection conn = new SqlConnection(DBConfig.ConnectionString); conn.Open(); ////StarterA: ////{"UserID":"10","UserName":"******","AppName":"SamplePrice","AppInstanceID":"100","ProcessGUID":"072af8c3-482a-4b1c-890b-685ce2fcc75d"} var initiator = new WfAppRunner(); initiator.AppName = "SamplePrice"; initiator.AppInstanceID = 100; initiator.ProcessGUID = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d"); initiator.UserID = 10; initiator.UserName = "******"; IWorkflowService service = new WorkflowService(); //流程开始->业务员提交 IDbTransaction trans = conn.BeginTransaction(); try { service.StartProcess(conn, initiator, trans); trans.Commit(); } catch { trans.Rollback(); throw; } finally { trans.Dispose(); } //业务员提交->板房签字 var banFangNodeGuid = "fc8c71c5-8786-450e-af27-9f6a9de8560f"; PerformerList pList = new PerformerList(); pList.Add(new Performer(20, "Zhang")); initiator.NextActivityPerformers = new Dictionary<Guid, PerformerList>(); initiator.NextActivityPerformers.Add(Guid.Parse(banFangNodeGuid), pList); trans = conn.BeginTransaction(); try { service.RunProcessApp(conn, initiator, trans); trans.Commit(); } catch { trans.Rollback(); throw; } finally { trans.Dispose(); } //板房签字->业务员签字 //登录用户身份 initiator.UserID = 20; initiator.UserName = "******"; var salesGuid = "39c71004-d822-4c15-9ff2-94ca1068d745"; pList.Clear(); pList.Add(new Performer(10, "Long")); initiator.NextActivityPerformers.Clear(); initiator.NextActivityPerformers.Add(Guid.Parse(salesGuid), pList); trans = conn.BeginTransaction(); try { service.RunProcessApp(conn, initiator, trans); trans.Commit(); } catch { trans.Rollback(); throw; } finally { trans.Dispose(); } //业务员签字->结束 //登录用户身份 initiator.UserID = 10; initiator.UserName = "******"; var endGuid = "b70e717a-08da-419f-b2eb-7a3d71f054de"; pList.Clear(); pList.Add(new Performer(10, "Long")); initiator.NextActivityPerformers.Clear(); initiator.NextActivityPerformers.Add(Guid.Parse(endGuid), pList); trans = conn.BeginTransaction(); try { service.RunProcessApp(conn, initiator, trans); trans.Commit(); } catch { trans.Rollback(); throw; } finally { trans.Dispose(); } if (conn.State == ConnectionState.Open) conn.Close(); }
public ResponseResult<IDictionary<Guid, PerformerList>> GetNextActivityPerformers() { var performers = new PerformerList(); performers.Add(new Performer("10", "Long")); IDictionary<Guid, PerformerList> nexts = new Dictionary<Guid, PerformerList>(); nexts[Guid.Parse("10f7481a-ad1a-40f6-aeaa-8d32ceb1fcab")] = performers; return ResponseResult<IDictionary<Guid, PerformerList>>.Success(nexts); }
/// <summary> /// 创建下一步的执行人员列表 /// </summary> /// <param name="view"></param> /// <returns></returns> private IDictionary<String, PerformerList> CreateNextActivityPerformers(NodeView view) { var nextDict = new Dictionary<String, PerformerList>(); UserModel um = new UserModel(); PerformerList pl = new PerformerList(); foreach (Role role in view.Roles) { var a = um.GetUsersByRoleCode(role.RoleCode); //根据角色代码获取人员 foreach (UserEntity u in a) { pl.Add(new Performer(u.ID.ToString(), u.UserName)); } } nextDict[view.ActivityGUID] = pl; return nextDict; }
public IDictionary<string, PerformerList> NextActivityPerformers(string nextActivityPerformers) { IDictionary<string, PerformerList> nextActivityPerformersDictionary = new Dictionary<string, PerformerList>(); string[] array = nextActivityPerformers.Split(','); foreach (string items in array) { string stepId = GetValueOfNodeIdList(items, "step"); if (!string.IsNullOrWhiteSpace(stepId) && stepId != "0") { string userId = GetValueOfNodeIdList(items, "member"); Performer performer = null; if (!string.IsNullOrWhiteSpace(userId) && userId != "0" && userId.Length > 0) { SysUserEntity userEntity = WorkFlows.GetSysUserModel(Convert.ToInt32(userId)); if (userEntity != null && userEntity.ID > 0) { performer = new Performer(userId, userEntity.UserName); } } if (performer == null) performer = new Performer("0", string.Empty); if (nextActivityPerformersDictionary.ContainsKey(stepId)) { (nextActivityPerformersDictionary[stepId]).Add(performer); } else { PerformerList pList = new PerformerList(); pList.Add(performer); nextActivityPerformersDictionary.Add(stepId, pList); } } } return nextActivityPerformersDictionary; }
/// <summary> /// 生成任务办理人字符串列表 /// </summary> /// <param name="performerList"></param> /// <returns></returns> protected string GenerateActivityAssignedUsers(PerformerList performerList) { StringBuilder strBuilder = new StringBuilder(1024); foreach (var performer in performerList) { if (strBuilder.ToString() != "") strBuilder.Append(","); strBuilder.Append(performer.UserID); } return strBuilder.ToString(); }
//提交请假信息 protected void btnSave_Click(object sender, EventArgs e) { try { string processGUID = this.txtProcessGUID.Value.ToString(); string stepGuid = this.hiddenStepGuid.Value.ToString(); int stepUserID = Helper.ConverToInt32(this.hiddenStepUser.Value.ToString().Trim()); decimal days = Helper.ConverToDecimal(this.txtDays.Value); int leaveType = Helper.ConverToInt32(selectLeaveType.Value); int nextUserID = 0; string nextUserName = string.Empty; SysUserEntity userEntity = WorkFlows.GetSysUserModel(stepUserID); if (userEntity != null && userEntity.ID > 0) { nextUserID = userEntity.ID; nextUserName = userEntity.UserName; } DateTime now = DateTime.Now; //请假业务数据 HrsLeaveEntity hrsLeaveEntity = new HrsLeaveEntity(); hrsLeaveEntity.LeaveType = leaveType; hrsLeaveEntity.Days = days; try { hrsLeaveEntity.FromDate = Helper.ConvertToDateTime(this.txtFromDate.Value, now); } catch (Exception ex) { hrsLeaveEntity.FromDate = now; } try { hrsLeaveEntity.ToDate = Helper.ConvertToDateTime(this.txtToDate.Value, now); } catch (Exception ex) { hrsLeaveEntity.ToDate = now; } hrsLeaveEntity.CurrentActivityText = string.Empty; hrsLeaveEntity.Status = 0; hrsLeaveEntity.CreatedUserID = LoginUserID; hrsLeaveEntity.CreatedUserName = this.LoginUserName; hrsLeaveEntity.CreatedDate = now; int instanceId = WorkFlows.AddHrsLeave(hrsLeaveEntity); if (instanceId > 0) { //调用流程 IWorkflowService service = new WorkflowService(); WfAppRunner initiator = new WfAppRunner(); initiator.AppName = "请假流程"; initiator.AppInstanceID = instanceId.ToString(); initiator.ProcessGUID = processGUID; initiator.UserID = LoginUserID.ToString(); initiator.UserName = LoginUserName; initiator.Conditions = GetCondition(string.Format("days-{0}", days)); WfExecutedResult startedResult = service.StartProcess(initiator); if (startedResult.Status != WfExecutedStatus.Success) { base.RegisterStartupScript("", "<script>alert('" + startedResult.Message + "');</script>"); return; } //送往下一步 PerformerList pList = new PerformerList(); pList.Add(new Performer(nextUserID.ToString(), nextUserName)); initiator.NextActivityPerformers = new Dictionary<String, PerformerList>(); initiator.NextActivityPerformers.Add(stepGuid, pList); WfExecutedResult runAppResult = service.RunProcessApp(initiator); if (runAppResult.Status != WfExecutedStatus.Success) { base.RegisterStartupScript("", "<script>alert('" + runAppResult.Message + "');</script>"); return; } //保存业务数据 BizAppFlowEntity AppFlowEntity = new Entity.BizAppFlowEntity(); AppFlowEntity.AppName = "流程发起"; AppFlowEntity.AppInstanceID = instanceId.ToString(); AppFlowEntity.ActivityName = "流程发起"; AppFlowEntity.Remark = string.Format("申请人:{0}-{1}", LoginUserID, LoginUserName); AppFlowEntity.ChangedTime = now; AppFlowEntity.ChangedUserID = LoginUserID; AppFlowEntity.ChangedUserName = LoginUserName; WorkFlows.AddBizAppFlow(AppFlowEntity); base.RegisterStartupScript("", "<script>alert('流程发起成功');window.location.href='FlowList.aspx';</script>"); } } catch (Exception ex) { base.RegisterStartupScript("", "<script>alert('流程发起出现异常 EXCEPTION:" + ex.ToString() + "');</script>"); } }
public void StartupParalleled() { IDbConnection conn = new SqlConnection(DBConfig.ConnectionString); conn.Open(); //StarterA: //{"UserID":"10","UserName":"******","AppName":"SamplePrice","AppInstanceID":"100","ProcessGUID":"072af8c3-482a-4b1c-890b-685ce2fcc75d"} var starterA = new WfAppRunner(); starterA.ProcessGUID = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d"); starterA.UserID = 10; starterA.UserName = "******"; var runnerA = new WfAppRunner(); runnerA.ProcessGUID = Guid.Parse("072af8c3-482a-4b1c-890b-685ce2fcc75d"); runnerA.UserID = 10; runnerA.UserName = "******"; PerformerList pList = new PerformerList(); pList.Add(new Performer(20, "Xiao")); runnerA.NextActivityPerformers = new Dictionary<Guid, PerformerList>(); runnerA.NextActivityPerformers.Add(Guid.Parse("fc8c71c5-8786-450e-af27-9f6a9de8560f"), pList); IWorkflowService serviceA; IDbTransaction trans = null; //STARTUP 2000 TIMES //for (var i = 0; i < 2000; i++) //{ // serviceA = new WorkflowService(); // starterA.AppName = "price"; // starterA.AppInstanceID = i; // try // { // trans = conn.BeginTransaction(); // serviceA.StartProcess(conn, starterA, trans); // trans.Commit(); // } // catch // { // trans.Rollback(); // throw; // } // finally // { // trans.Dispose(); // } //} ////RUN process 2000 TIMES for (var i = 0; i < 2000; i++) { serviceA = new WorkflowService(); runnerA.AppInstanceID = i; runnerA.AppName = "price"; try { trans = conn.BeginTransaction(); serviceA.RunProcessApp(conn, runnerA, trans); trans.Commit(); } catch { trans.Rollback(); throw; } finally { trans.Dispose(); } } if (conn.State == ConnectionState.Open) conn.Close(); }
//送往下一步 protected void btnSendNext_Click(object sender, EventArgs e) { try { string processGUID = this.txtProcessGUID.Value.ToString(); string stepGuid = this.hiddenStepGuid.Value.ToString(); int stepUserID = Helper.ConverToInt32(this.hiddenStepUser.Value.ToString().Trim()); decimal days = Helper.ConverToDecimal(this.txtDays.Value); string instanceId = this.hiddenInstanceId.Value; string DepManagerRemark = this.txtDepmanagerRemark.Value; string DirectorRemark = this.txtDirectorRemark.Value; string DeputyGeneralRemark = this.txtDeputyGeneralRemark.Value; string GeneralManagerRemark = this.txtGeneralManagerRemark.Value; int activityInstanceID = Helper.ConverToInt32(hiddenActivityInstanceID.Value); string CurrentActivityText = string.Empty; ; int nextUserID = 0; string nextUserName = string.Empty; SysUserEntity userEntity = WorkFlows.GetSysUserModel(stepUserID); if (userEntity != null && userEntity.ID > 0) { nextUserID = userEntity.ID; nextUserName = userEntity.UserName; } DateTime now = DateTime.Now; if (!string.IsNullOrEmpty(instanceId)) { //调用流程 IWorkflowService service = new WorkflowService(); WfAppRunner initiator = new WfAppRunner(); initiator.AppName = "请假流程"; initiator.AppInstanceID = instanceId; initiator.ProcessGUID = processGUID; initiator.UserID = LoginUserID.ToString(); initiator.UserName = LoginUserName; initiator.Conditions = GetCondition(string.Format("days-{0}", days)); //送往下一步 PerformerList pList = new PerformerList(); pList.Add(new Performer(nextUserID.ToString(), nextUserName)); initiator.NextActivityPerformers = new Dictionary<String, PerformerList>(); initiator.NextActivityPerformers.Add(stepGuid, pList); WfExecutedResult runAppResult = service.RunProcessApp(initiator); if (runAppResult.Status != WfExecutedStatus.Success) { base.RegisterStartupScript("", "<script>alert('" + runAppResult.Message + "');</script>"); return; } ProcessEntity processEntity = service.GetProcessById(processGUID); if (processEntity != null) { ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID); if (activityInstanceEntity != null) { CurrentActivityText = activityInstanceEntity.ActivityName; } } try { //保存业务数据 BizAppFlowEntity AppFlowEntity = new Entity.BizAppFlowEntity(); AppFlowEntity.AppName = "请假流程"; AppFlowEntity.AppInstanceID = instanceId.ToString(); AppFlowEntity.ActivityName = CurrentActivityText; AppFlowEntity.Remark = string.Format("申请人:{0}-{1}", LoginUserID, LoginUserName) + CurrentActivityText; AppFlowEntity.ChangedTime = now; AppFlowEntity.ChangedUserID = LoginUserID; AppFlowEntity.ChangedUserName = LoginUserName; WorkFlows.AddBizAppFlow(AppFlowEntity); } catch (Exception ex) { } try { HrsLeaveEntity hrsLeaveEntity = new Entity.HrsLeaveEntity(); hrsLeaveEntity.ID = Helper.ConverToInt32(instanceId); hrsLeaveEntity.DepManagerRemark = DepManagerRemark; hrsLeaveEntity.DirectorRemark = DirectorRemark; hrsLeaveEntity.DeputyGeneralRemark = DeputyGeneralRemark; hrsLeaveEntity.GeneralManagerRemark = GeneralManagerRemark; hrsLeaveEntity.CurrentActivityText = CurrentActivityText; WorkFlows.UpdateHrsLeave(hrsLeaveEntity); } catch (Exception ex) { } base.RegisterStartupScript("", "<script>alert('办理成功');window.location.href='FlowList.aspx';</script>"); } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('流程发起出现异常 EXCEPTION:" + ex.ToString() + "');</script>"); } }
/// <summary> /// XML节点预定义跳转 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSkip_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = "WallwaOrder"; appRunner.UserID = "13"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); var nodeViewList = wfService.GetNextActivityTree(appRunner); if (nodeViewList != null && nodeViewList.Count() == 1) { var nodeView = nodeViewList[0]; if (nodeView.IsSkipTo == true) { //下一步执行人 PerformerList list = new PerformerList(); Performer p = new Performer("1", "admin");//下一步人ID,Name list.Add(p); Dictionary<String, PerformerList> dict = new Dictionary<String, PerformerList>(); dict.Add(nodeView.ActivityGUID, list); //nodeView.ID 下一步节点的标识ID appRunner.NextActivityPerformers = dict; var result = wfService.JumpProcess(appRunner); var msg = string.Format("流程跳转结果:{0}\r\n", result.Status); textBox1.Text += msg; } } }