2010-12-09 69 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