不是第一个,也不是最后一个打开的,流转时出错
procedure TTXTZDCT.FlowBroker1CreateFlowOutFlowTasks(Sender: TObject; Command: TFlowOutCommand);
var
lform :TXZFFFWCT;
lFlowTask:TFlowTask;
lOrgURL: TOrgURL;
lStr:string;
dept,post,per:string;
begin
if (flowbroker1.FlowControl.CurrentProcUnit.ID = 'TXTZD') and
(Dsb_Detail.DataSet.IsEmpty) then
begin
business.Forms.jsDialogs.ShowError('请选择发放范围!','系统提示');
lform := TXZFFFWCT.Create(self.Context);
try
lform.ShowModal;
finally
lform.Free;
end;
sysutils.Abort;
end;
//审批意见
if (flowbroker1.FlowControl.CurrentProcUnit.ID = 'SPTZD') and
(Dsb_Master.DataSet.FieldByName('FEnxamineMind').IsNull) then
begin
Business.Forms.jsDialogs.ShowWarning('请填写审批意见!','系统提示');
sysutils.Abort;
end;
if (flowbroker1.FlowControl.CurrentProcUnit.ID = 'SPTZD') and
(Dsb_Master.DataSet.FieldByName('FEnxamineMind').AsString = '不同意') then
begin
Business.Forms.jsDialogs.ShowError('请选择回退!','系统提示');
sysutils.Abort;
end;
begin
lFlowTask := Command.FlowTasks.FindFlowTask('CKTZD');
//根据任务环节查找任务
if lFlowTask <> nil then
lFlowTask.Executors.Clear; //删除缺省执行者
Dsb_Detail.DataSet.Open;
Dsb_Detail.DataSet.First;
while not Dsb_Detail.DataSet.Eof do
begin
dept := Dsb_Detail.DataSet.FieldByName('FDeptID').AsString;
post := Dsb_Detail.DataSet.FieldByName('FPostID').AsString;
per := Dsb_Detail.DataSet.FieldByName('FPerID').AsString;
//lStr:= zxz;
if lFlowTask <> nil then
begin
lOrgURL := TOrgURL.Create(dept,post,per); //部门、岗位、人员创建组织单元
lFlowTask.Executors.Add(lOrgURL);//添加执行者
end;
Dsb_Detail.DataSet.Next;
end;
end;
if (flowbroker1.FlowControl.CurrentProcUnit.ID = 'CKTZD') then
begin
Dsb_Detail.DataSet.Edit;
Dsb_Detail.DataSet.FieldByName('FDate').AsDateTime := sysutils.Now;
Dsb_Detail.DataSet.ApplyUpdates;
end;
end; |