procedure TMainForm.FlowBroker1CreateFlowOutFlowTasks(Sender: TObject; Command: TFlowOutCommand);
var
lFlowTask: TFlowTask;
//ContextCurrent:TContextCurrent;
lOrgURL: TOrgURL;
Person: TPerson;
begin
if DataSetBroker1.DataSet.RecordCount=0 then
begin
Business.Forms.Dialogs.ShowMessage('流转时检测到项目数据集为零');
end
else
begin
lflowTask:=Command.FlowTasks.FindFlowTask(FlowBroker1.FlowControl.CurrentProcUnit.SuccedentUnits[0]);
lFlowTask.Executors.Clear;
DataSetBroker1.DataSet.First;
//DataSetBroker1.DataSet有n条记录,将产n个任务
while not DataSetBroker1.DataSet.eof do
begin
Person:=OrgSys.OrgSystem.FindPerson(DataSetBroker1.DataSet.FieldByName('YJSHR').AsString);
//接受任务的人员ID
lOrgURL:=TOrgURL.Create('YPJCBM','YPZR',Person.ID);
lflowTask.Executors.Add(lOrgURl);
Dialogs.ShowMessage('增加任务到' +DataSetBroker1.DataSet.FieldByName('YJSHR').AsString +' 成功');
DataSetBroker1.DataSet.Next;
end;
Command.UserModify := False;
end
end;