阅读:2547
回复:7
|
等待节点如何使用代码完成 |
1楼#
发布于:2018-12-03 16:32
.net版本下代码,供参考
var workItem = Engine.WorkItemManager.GetWorkItem("WorkitemId"); Engine.WorkItemManager.FinishWorkItem ( workItem.ObjectID, "操作用户的Id", OThinker.H3.WorkItem.AccessPoint.Web, null, null, OThinker.Data.BoolMatchValue.True, "审批意见", "提交类型文本", OThinker.H3.WorkItem.ActionEventType.Normal, (int)OThinker.H3.WorkSheet.SheetButtonType.Submit ); var endMessage = new OThinker.H3.Messages.AsyncEndMessage( OThinker.H3.Messages.MessageEmergencyType.Normal, workItem.InstanceId, workItem.ActivityName, workItem.ReplyID, false, OThinker.Data.BoolMatchValue.Unspecified, true, null); Engine.InstanceManager.SendMessage(endMessage); |
|
2楼#
发布于:2018-12-03 16:37
|
|
|
3楼#
发布于:2018-12-03 17:07
|
|
4楼#
发布于:2018-12-03 17:43
|
|
5楼#
发布于:2018-12-03 18:14
代码如下:
string instanceId = "a29a337b-b1f8-4abb-8128-be5659432f78"; var connection = new OThinker.H3.Connection(); connection.Open("HostAddress", 8211, "administrator", "E10ADC3949BA59ABBE56E057F20F883E"); var instance = connection.Engine.InstanceManager.GetInstanceContext(instanceId); var allActivities = instance.Activities; var runningActivitieNames = instance.RunningActivties; var runningActivities = allActivities.Where(a => runningActivitieNames.Contains(a.Name)).ToList(); var workflow=connection.Engine.WorkflowManager.GetWorkflow(instance.WorkflowPackage,instance.WorkflowName,instance.WorkflowVersion).Activities; runningActivities.ForEach(a => { var activity=workflow.Where(obj=>obj.Name==a.Name).FirstOrDefault(); //此处加自己的验证逻辑 if (activity.ActivityType == OThinker.H3.WorkflowTemplate.ActivityType.Wait) { connection.Engine.TokenPool.Finish(instance.InstanceId, a.TokenId, true, OThinker.Data.BoolMatchValue.Unspecified); var endMessage = new OThinker.H3.Messages.AsyncEndMessage(OThinker.H3.Messages.MessageEmergencyType.Normal, instance.InstanceId, a.Name, -1, false, OThinker.Data.BoolMatchValue.Unspecified, true, null); connection.Engine.InstanceManager.SendMessage(endMessage); } }); |
|
6楼#
发布于:2018-12-04 09:59
|
|
7楼#
发布于:2018-12-04 11:25
已解决,方法如下:
InstanceContext instanceContext = getEngine().getInstanceManager().GetInstanceContext(instanceId); Token runningToken = instanceContext.GetRunningToken(waitingActivityCode); AsyncEndMessage asyncEndMessage = new AsyncEndMessage(MessageEmergencyType.Normal, instanceId, waitingActivityCode, runningToken.getTokenId(), BoolMatchValue.Unspecified, false, BoolMatchValue.Unspecified, true, null); getEngine().getInstanceManager().SendMessage(asyncEndMessage); |
|