以下是我在测试一个工作流时所使用的脚本,记录一下,免得忘了。
Sub MsgProcesses
Dim oAppPath As String = replace(K2App.Solution.Projects.Item("KMOAFLOW").filename.tolower,"KMOAFLOW".tolower & ".kpj","")
'将Line规则的内容显示出来。
'Dim ProcessFolderCount As Integer
Dim i As Integer
Dim TempFolder As K2Studio.ProcessFolder
'GetProcess( K2app.Solution.Projects.Item("KMOAFLOW").ProcessFolder.ProcessFolders.Item(0))
For i = 0 To K2app.Solution.Projects.Item("KMOAFLOW").ProcessFolder.ProcessFolders.Count -1
Call GetProcess(K2app.Solution.Projects.Item("KMOAFLOW").ProcessFolder.ProcessFolders.Item(CInt(i)))
Next
MsgBox("Done")
End Sub
Sub DoNone(AProcessFolder As K2Studio.ProcessFolder)
End Sub
Sub GetProcess(AProcessFolder As Object)
'MsgBox(AProcessFolder.ProcessFolders.Count)
Dim i As Integer
For i = 0 To (AProcessFolder.ProcessFolders.Count -1)
GetProcess(AProcessFolder.ProcessFolders.Item(CInt(I)))
Next
'MsgBox("Get1")
For i = 0 To AProcessFolder.Processes.Count -1
DoProcess(AProcessFolder.Processes.Item(CInt(I)))
Next
End Sub
Sub DoProcess(AProcess As Object)
Dim i As Integer
Dim ALine As Object
Dim AString As String
Dim ACode As String
Dim APos As Integer
For i = 0 To AProcess.Lines.Count -1
AString = ""
ALine = AProcess.Lines.Item(CInt(I))
ACode = ALine.LineRule.Code
APos = InStr(ACode, "secondVariable =")
If APos >0 Then
AString = Mid(ACode, APos + 17, 3)
APos = InStr(APos + 17, ACode,"secondVariable =")
If APos >0 Then
AString = AString & Mid(ACode, APos + 17, 3)
End If
End If
ALine.Label = AString
'ALine.Label = ALine.LineRule.Code
ALine.Description = ALine.LineRule.Code
Next
'MsgBox(AProcess.Name)
End Sub
'第一个审核人就是董事长的单据。
Sub DoProcess2(AProcess As Object)
Dim i As Integer
Dim AActive As K2Studio.Activity
Dim AString As String
Dim ACode As String
Dim APos As Integer
For i = 0 To AProcess.Activities.Count -1
AActive = AProcess.Activities.Item(CInt(i))
If AActive.Name = "董事长" Then
If AActive.FinishLines.Count =1 Then
If (AActive.FinishLines.Item(0).StartActivity.Name = "初始化") Or (AActive.FinishLines.Item(0).StartActivity.Name = "Start") Then
MsgBox(AProcess.Name)
'MsgBox(AActive.Name & AActive.FinishLines.Item(0).StartActivity.Name)
End If
End If
End If
Next
End Sub
Sub MsgProcesses
Dim oAppPath As String = replace(K2App.Solution.Projects.Item("KMOAFLOW").filename.tolower,"KMOAFLOW".tolower & ".kpj","")
'将Line规则的内容显示出来。
'Dim ProcessFolderCount As Integer
Dim i As Integer
Dim TempFolder As K2Studio.ProcessFolder
'GetProcess( K2app.Solution.Projects.Item("KMOAFLOW").ProcessFolder.ProcessFolders.Item(0))
For i = 0 To K2app.Solution.Projects.Item("KMOAFLOW").ProcessFolder.ProcessFolders.Count -1
Call GetProcess(K2app.Solution.Projects.Item("KMOAFLOW").ProcessFolder.ProcessFolders.Item(CInt(i)))
Next
MsgBox("Done")
End Sub
Sub DoNone(AProcessFolder As K2Studio.ProcessFolder)
End Sub
Sub GetProcess(AProcessFolder As Object)
'MsgBox(AProcessFolder.ProcessFolders.Count)
Dim i As Integer
For i = 0 To (AProcessFolder.ProcessFolders.Count -1)
GetProcess(AProcessFolder.ProcessFolders.Item(CInt(I)))
Next
'MsgBox("Get1")
For i = 0 To AProcessFolder.Processes.Count -1
DoProcess(AProcessFolder.Processes.Item(CInt(I)))
Next
End Sub
Sub DoProcess(AProcess As Object)
Dim i As Integer
Dim ALine As Object
Dim AString As String
Dim ACode As String
Dim APos As Integer
For i = 0 To AProcess.Lines.Count -1
AString = ""
ALine = AProcess.Lines.Item(CInt(I))
ACode = ALine.LineRule.Code
APos = InStr(ACode, "secondVariable =")
If APos >0 Then
AString = Mid(ACode, APos + 17, 3)
APos = InStr(APos + 17, ACode,"secondVariable =")
If APos >0 Then
AString = AString & Mid(ACode, APos + 17, 3)
End If
End If
ALine.Label = AString
'ALine.Label = ALine.LineRule.Code
ALine.Description = ALine.LineRule.Code
Next
'MsgBox(AProcess.Name)
End Sub
'第一个审核人就是董事长的单据。
Sub DoProcess2(AProcess As Object)
Dim i As Integer
Dim AActive As K2Studio.Activity
Dim AString As String
Dim ACode As String
Dim APos As Integer
For i = 0 To AProcess.Activities.Count -1
AActive = AProcess.Activities.Item(CInt(i))
If AActive.Name = "董事长" Then
If AActive.FinishLines.Count =1 Then
If (AActive.FinishLines.Item(0).StartActivity.Name = "初始化") Or (AActive.FinishLines.Item(0).StartActivity.Name = "Start") Then
MsgBox(AProcess.Name)
'MsgBox(AActive.Name & AActive.FinishLines.Item(0).StartActivity.Name)
End If
End If
End If
Next
End Sub