|
发表于 2007-6-27 18:14:16
|
显示全部楼层
1、获得流程实例
var
lFlowParam: TLoadFlowParam;
begin
if Assigned(FFlowList) then
FFlowList.Free;
FFlowList := TObjectList.Create;
lFlowParam := TLoadFlowParam.Create;
try
lFlowParam.States := [TFlowState.fsProcessing, TFlowState.fsWaiting];
lFlowParam.GUIDs.Add('AE8D4F2D673C438A90E6CB78E198F176'); //通过流程GUID获得流程实例
Flow.FlowEngine.GetFlows(lFlowParam, FFlowList);
FFlow := TFlow(FFlowList.Items[0]);
if Assigned(FFlow) then
begin
memo1.Lines.Clear;
memo1.Lines.Add(SysUtils.IntToStr(FFlowList.Count));
memo1.Lines.Add(FFlow.Subject);
end;
finally
lFlowParam.Free;
end;
end;
2、获得流程当前任务
var
lTask: TTask;
lList: TList;
begin
lList := TList.Create;
try
FFlow.GetLastTasks(lList); //获得流程的当前任务
lTask := TTask(lList.Items[0]);
if Assigned(lTask) then
begin
memo2.Lines.Clear;
memo2.Lines.Add(SysUtils.IntToStr(lList.Count));
memo2.Lines.Add(lTask.Subject);
memo2.Lines.Add(lTask.SenderName);
end;
finally
lList.Free;
end;
end;
3、运行任务
SystemCore.TSystemCore.FuncManager.RunTask(Context, lTask); //需要引用系统核心库 |
|