|
流程缺省执行者如果设置为 1<>1 在流转时就会出错,去掉1<>1就正常了。
出错单元[流程公共库]红色代码处,见下图
麻烦快一点,等着给客户演示。。。
static procedure TDefaultFlowExecutorsManager.RefreshExecutors(ACommand: TFlowCommand);
var
I, J: Integer;
lProcURL, lProcUnitID, lExecutor : String;
lBizURL: TBizURL;
lOrgURL: TOrgURL;
lOrgURLs: TOrgURLs;
lCommand: TFlowTaskCommand;
lDefault: TStringList;
lQuery: TQuery;
lFlowTask: TFlowTask;
begin
if not IsManageCommand(ACommand) then
Exit;
lCommand := TFlowTaskCommand(ACommand);
lBizURL := TBizURL.Create;
lDefault:= TStringList.Create;
lQuery := TQuery.Create(nil);
try
for I := 0 to lCommand.AllowFlowTasks.Count - 1 do
lDefault.AddObject(GetProcURL(lCommand.AllowFlowTasks[I]) + '[' +
lCommand.AllowFlowTasks[I].ProcUnit.ID + ']', TOrgURLs.Create);
lQuery.ConnectionString := cDBConnectStr;
lQuery.CommandText := SysUtils.Format('SELECT * FROM TFLOWDEFAULTEXECUTOR WHERE FOWNER = ''%s'' AND FSPROCURL = ''%s'' AND FSPROCUNITID = ''%s'' AND FFLOWCOMMANDID = %d',
[GetOrgURLSaveStr(GetOwner(lCommand)),
SysUtils.UpperCase(ACommand.FlowControl.CurrentProcUnit.Proc.BizClassURL.BizURL.URL),
SysUtils.UpperCase(ACommand.FlowControl.CurrentProcUnit.ID),
ACommand.ID]);
lQuery.Open;
while not lQuery.Eof do
begin
lProcURL := lQuery.FieldByName('FTPROCURL').AsString;
lProcUnitID := lQuery.FieldByName('FTPROCUNITID').AsString;
lExecutor := lQuery.FieldByName('FEXECUTOR').AsString;
for I := 0 to lCommand.AllowFlowTasks.Count - 1 do
begin
lFlowTask := lCommand.AllowFlowTasks[I];
if not (SysUtils.SameText(GetProcURL(lFlowTask), lProcURL) and
SysUtils.SameText(lFlowTask.ProcUnit.ID, lProcUnitID)) then
continue;
if lFlowTask.Executors.Count = 0 then
lFlowTask := lCommand.FlowTasks.FindFlowTask(lFlowTask.ProcUnit);
for J := 0 to lFlowTask.Executors.Count - 1 do
if SysUtils.SameText(lFlowTask.Executors[J].BizURL.URL, lExecutor) then
begin
lBizURL.URL := lExecutor;
lOrgURL := TOrgURL.Create(lBizURL);
TOrgURLs(lDefault.Objects[lDefault.IndexOf(lProcURL + '[' + lProcUnitid + ']')]).Add(lORgURL);
break;
end;
if J = lFlowTask.Executors.Count then
for J := 0 to lFlowTask.AllowExecutors.Count - 1 do
if SysUtils.SameText(lFlowTask.AllowExecutors[J].BizURL.URL, lExecutor) then
begin
lBizURL.URL := lExecutor;
lOrgURL := TOrgURL.Create(lBizURL);
TOrgURLs(lDefault.Objects[lDefault.IndexOf(lProcURL + '[' + lProcUnitid + ']')]).Add(lORgURL);
break;
end;
end;
lQuery.Next;
end;
for I := 0 to lCommand.FlowTasks.Count - 1 do
begin
lOrgURLs := TOrgURLs(lDefault.Objects[lDefault.IndexOf(GetProcURL(lCommand.FlowTasks[I]) + '[' + lCommand.FlowTasks[I].ProcUnit.ID + ']')]);
if lOrgURLs.Count > 0 then //如果未取到交集,跳过,不做处理
lCommand.FlowTasks[I].Executors.Assign(lOrgURLs);
end;
for I := 0 to lCommand.AllowFlowTasks.Count - 1 do
begin
lOrgURLs := TOrgURLs(lDefault.Objects[lDefault.IndexOf(GetProcURL(lCommand.AllowFlowTasks[I]) + '[' + lCommand.AllowFlowTasks[I].ProcUnit.ID + ']')]);
if lOrgURLs.Count > 0 then //如果未取到交集,跳过,不做处理
lCommand.AllowFlowTasks[I].Executors.Assign(lOrgURLs);
end;
finally
for I := lDefault.Count - 1 downto 0 do
lDefault.Objects[I].Free;
lQuery.Free;
lDefault.Free;
lBizURL.Free;
end;
end;
|
|