流程的两个环节都使用了同一个功能,即:填写和审批
当填写环节时,能够正确进入OnCreateFlowOutFlowTasks,
但是,当运行审批时,就不进入OnCreateFlowOutFlowTasks事件了,请问是什么问题?如何解决
代码如下
procedure TDesignTaskRequisitionInOroutMainForm.FlowBroker1CreateFlowOutFlowTasks(Sender: TObject; Command: TFlowOutCommand);
var
FlowTask1 : TFlowTask;
OrgURL1, OrgURL2 : TOrgURL;
i: integer;
ReceiveDept : string;
Position : string;
begin
Inherited;
//当下一环节为“指定责任部门”,执行者项目部项目管理员。
if (FlowBroker1.FlowControl.CurrentProcUnit.ID = 'MakeDesignTaskRequisitionInOroutBill') then
begin
FlowTask1 := Command.FlowTasks.FindFlowTask('AssignDutyDept');
if FlowTask1 <> nil then
begin
FlowTask1.Executors.Clear;
FlowTask1.Executors.Add('XMGLB401S','XMGLY','');
FlowTask1.Executors.Add('XMGLBJSQS','XMGLY','');
FlowTask1.AllowExecutorInOrgURLs.Add('XMGLB401S','XMGLY','');
FlowTask1.AllowExecutorInOrgURLs.Add('XMGLBJSQS','XMGLY','');
end;
end;
//当下一环节为“发出部门领导审批”,执行者为发出部门所级领导;
if (FlowBroker1.FlowControl.CurrentProcUnit.ID = 'MakeDesignTaskRequisitionInOroutBill') then
begin
FlowTask1 := Command.FlowTasks.FindFlowTask('SendDeptLeaderAudit');
if FlowTask1 <> nil then
begin
Position := '';
FlowTask1.Executors.Clear;
FlowTask1.AllowExecutors.Clear;
//ContextCurrent1.Dept.Parent.ID
InfoBroker1.Info.DataSetByID('TORGSYSTEM').SQLFilter := ' FKIND = '''+'.psm'+''' '+
'and (FPOSITION = '''+'SZ'+''' or FPOSITION = '''+'FSZ'+''') '+
'and (FDEPT='''+ContextCurrent1.Dept.ID+''' or FDEPT='''+ContextCurrent1.Dept.Parent.ID+''')';
InfoBroker1.Info.DataSetByID('TORGSYSTEM').SQLFiltered := True;
InfoBroker1.Info.DataSetByID('TORGSYSTEM').Open;
for i:=1 to InfoBroker1.Info.DataSetByID('TORGSYSTEM').RecordCount do
begin
ReceiveDept := InfoBroker1.Info.DataSetByID('TORGSYSTEM').FieldByName('FDEPT').AsString;
Position := InfoBroker1.Info.DataSetByID('TORGSYSTEM').FieldByName('FPOSITION').AsString;
FlowTask1.Executors.Add(ReceiveDept,Position,InfoBroker1.Info.DataSetByID('TORGSYSTEM').FieldByName('FPERSON').AsString);
FlowTask1.AllowExecutors.ADD(ReceiveDept,Position,InfoBroker1.Info.DataSetByID('TORGSYSTEM').FieldByName('FPERSON').AsString);
InfoBroker1.Info.DataSetByID('TORGSYSTEM').Next;
end;
InfoBroker1.Info.DataSetByID('TORGSYSTEM').Close;
end;
end;
end; |