list := TOrgFuncItems.Create;
if OrgSys.OrgSystem.GetOrgUnitsFuncs(lOrgURLs, list, True) then
for I := 0 to list.Count - 1 do
begin
if list.Items[I].FuncURL.id= 'GN_PDSBDA' then //配电设备
begin
UserPower.SB:=true;
end;
if list.Items[I].FuncURL.id= 'GN_PDSBZTPJ' then//配电设备评价
begin
UserPower.PJ:=true;
end;
if list.Items[I].FuncURL.id= 'GN_PDDYZGZPTX' then //配电一种工作票 申请
begin
UserPower.YZGZP:=true;
end;
if list.Items[I].FuncURL.id= 'GN_SQPDDEZGZP' then //配电二种工作票 申请
begin
UserPower.RZGZP:=true;
end;
if list.Items[I].FuncURL.id= 'GN_PDSQRTXBDTDSQD' then//配电停电票申请
begin
UserPower.TDSQP:=true;
end;
if list.Items[I].FuncURL.id= 'GN_PDSBQXDJ' then //配电缺陷
begin
UserPower.SBQX:=true;
end;
end;
finally
lContextCurrent.Free;
list.Free;
end;
end;
采用如下方法解决掉
procedure TCT_PDGZT.InitUserPower;
var
//list: TOrgFuncItems;
list: TOrgFuncAllocItems;
OrgUnit:TOrgUnit;
I: integer;
lContextCurrent: Business.Model.TContextCurrent;
begin
try
list := TOrgFuncAllocItems.Create;
OrgSys.OrgSystem.GetAllFunc(lContextCurrent.OperatorPosition.PersonMember, TOrgFuncKind.ofkRun, list);
if (list.Count>0) then
begin
for I := 0 to list.Count - 1 do
begin
if TOrgFuncAllocItem(list.Items[I]).FuncURL= 'Biz:\SCMISYWKJ\GN_PDSBDA.Func' then //配电设备
begin
UserPower.SB:=true;
end;
if TOrgFuncAllocItem(list.Items[I]).FuncURL= 'Biz:\SCMISYWKJ\GN_BDSBZTPJ.Func' then//配电设备评价
begin
UserPower.PJ:=true;
end;
if TOrgFuncAllocItem(list.Items[I]).FuncURL= 'GN_PDDYZGZPTX' then //配电一种工作票 申请
begin
UserPower.YZGZP:=true;
end;
if TOrgFuncAllocItem(list.Items[I]).FuncURL= 'GN_SQPDDEZGZP' then //配电二种工作票 申请
begin
UserPower.RZGZP:=true;
end;
if TOrgFuncAllocItem(list.Items[I]).FuncURL= 'GN_PDSQRTXBDTDSQD' then//配电停电票申请
begin
UserPower.TDSQP:=true;
end;
if TOrgFuncAllocItem(list.Items[I]).FuncURL= 'Biz:\SCMISYWKJ\GN_PDSBQXDJ.Func' then //配电缺陷
begin
UserPower.SBQX:=true;
end;
end;
end;
finally
lContextCurrent.Free;
list.Free;
end;
end;