2010-12-09 52 views
2

我在K2 Blackpearl上分配了一项任务,该任务涉及在不使用产品界面的情况下直接停止某些工作项的过程,因为它没有达到目的。K2过程取消

问题在于,在此业务需求中,特定的支持者可以通过制作自定义应用程序从Excel文件中读取行并自动上传到K2来实现多个文档上传。

此解决方案的开发人员不再出席,他们的工作细节不可用。

我只是被告知可以使用自定义控制台应用程序来停止进程。

有人可以教我正确的道路吗? 我对K2没有任何经验,所以对于我来说这是一项艰巨的任务,因为我不熟悉它的流程。

回答

7

K2 API有很好的文档记录,可以从K2地下下载示例代码和演示应用程序。

的回答你的问题就在这里: k2underground.com/forums/p/12082/35429.aspx

我拉出的代码中的相关行:

//引用

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using SourceCode.Workflow.Management; 
using SourceCode.Hosting.Client.BaseAPI; 

//代码

// connection string 
SCConnectionStringBuilder scBuilder = new SCConnectionStringBuilder(); 
scBuilder.Authenticate = true; 
scBuilder.IsPrimaryLogin = true; 
scBuilder.Integrated = true; 
scBuilder.Host = "localhost"; 
scBuilder.Port = 5555; 

// connect to K2 Server 
WorkflowManagementServer wfmServer = new WorkflowManagementServer(); 

wfmServer.CreateConnection(); 
wfmServer.Connection.Open(scBuilder.ConnectionString); 

// optionally get a list of process instances to explore 
/* 
ProcessInstances procInst = 
    wfmServer.GetProcessInstancesAll(string.Empty, string.Empty, string.Empty); 
*/ 

// when you've got a proc inst you're interested in, stop it. 
int _procInstId = 123; // get this from your process instance context 
wfmServer.StopProcessInstances(_procInstId); 

你可以找到更多的代码SAM普莱斯在这里: Tim Byrne's blog re: K2

出几十可用的命名空间的API中的,在使用中最常见的命名空间(顺便说一句,该公司的名称是SourceCode):

> Sourcecode.Workflow.Client 
> SourceCode.Workflow.Management 
> SourceCode.SmartObjects.Client 

希望帮助。

+0

嗨sherif,谢谢你的回应。我会检查这个解决方案。 :) – janejanejane 2010-12-12 14:41:50