|

楼主 |
发表于 2008-4-15 11:32:28
|
显示全部楼层
谢谢你,写的真的太详细了
谢谢你,写的真的太详细了。我试你的代码完全正确,但是我把你的代码加到启动流程代码中,单步执行到lBizURL.URL:=AOrgBizURLs[0]; 就出错,请问是什么原因呢? 另外我想执行人中随机选择一个人员,是这样用Random的不?i:=System.Random((AOrgBizURLs.Count-1));//出错,请问Integer如何转为Longint?
代码如下,
procedure TMAINFORM.StartAlarmFlow1(AFlowIDPram:String);
var
lContextCurrent: TContextCurrent;
AOrgBizURLs:TStrings;
lExecutor: TOrgURL;
lBizURL: TBizURL;
AFlowUrl,ADept,ARole,APerson,AStartProc,AFlowID,ASubject,ADescription:String;
i:Integer;
begin
lContextCurrent := TContextCurrent.Create(Self.Context);
AOrgBizURLs := TStringlist.Create;
Org.OrgSys.OrgSystem.GetBizURLsByOrgExpr('OrgChildren(OrgSelect(OrgCondition('''','''',:OrgUnit.FuncRef = ''\WGXTDEMO\BJCL1_new.Func'')),OrgCondition(''*.psm'', '''', ''''), True) or OrgSelect(OrgCondition(''*.psm'','''',:OrgUnit.FuncRef= ''\OPERATION\LCRKGN.Func''))',AOrgBizURLs);
// for i := 0 to AOrgBizURLs.Count - 1 do
i:=System.Random((AOrgBizURLs.Count-1));//Integer如何转为Longint?
lBizURL.Create;
dialogs.ShowMessage(AOrgBizURLs[0]);//
lBizURL.URL:=AOrgBizURLs[0];//lBizURL.URL:=AOrgBizURLs;这儿会出错,见图
lExecutor:=TOrgURL.Create(lBizURL);
// end;
ADept:=lExecutor.DeptID;
ARole:=lExecutor.PositionID;
APerson:=lExecutor.PersonID;
AFlowUrl:='Biz:\WGXTDEMO\BJCL1LC.Proc';//流程处理1
ASubject:='代码启动报警处理1';
ADescription:='代码启动报警处理1描述';
AStartProc:='BJCL1_NEW'; //流程入口功能ID
AFlowID:=AFlowIDPram;
try
UserStartFlow (AFlowUrl,ADept,ARole,APerson,AStartProc,AFlowID,ASubject,ADescription);
finally
lContextCurrent.Free;
lBizURL.Free;
end;
end; |
|