运行系统初始化的时候发生异常:Access violation at address 025949F6 in module 'CLRModel.bpl'.
Read of address 0000004C
类型:EAccessViolation。
lFlowTask.Executors.Add(lOrgURL); 出错。。。。。。。。。。如何解决
=====================
procedure TMainForm.btnRunTaskClick(Sender: TObject);
var
lTaskParam: TLoadTaskParam;
lFlowParam: TLoadFlowParam;
lTasks: TTasks;
lDataSet : TDataSet;
lDetailForm : TXXXXCKCT;
lFlowTask:TFlowTask;
lOrgURL: TOrgURL;
lContextCurrent: TContextCurrent;
lOrgUnit: TOrgUnit;
ADept,ARole,APerson:String;
begin
lDataSet := DataSetBroker.DataSet;
if not lDataSet.Active or lDataSet.Eof then
Exit;
lFlowParam := TLoadFlowParam.Create;
lTaskParam := TLoadTaskParam.Create;
lTasks := TTasks.Create;
try
//根据ProductID,找到对应的流程Guid值
DoGetFlowGUIDs(lDataSet.FieldByName('Inst_ID').AsString, lFlowParam.GUIDs);
lTaskParam.States := [TTaskState.tsStarted, TTaskState.tsProcessing, TTaskState.tsWaiting];
//流程模型的BizURL
lFlowParam.ProcURLs.Add('Biz:\DMISXT\ZDHXSBTZTCLC.Proc') ;
//过滤用户
lContextCurrent := TContextCurrent.Create(Context);
lOrgUnit := lContextCurrent.PersonMember;
ADept := lOrgUnit.Parent.Parent.ID;
ARole := lOrgUnit.Parent.ID;
APerson := lOrgUnit.ID;
lOrgURL := TOrgURL.Create(ADept, ARole, APerson); //部门ID,岗位ID,人员ID
lFlowTask.Executors.Add(lOrgURL);
//以给定的条件查询任务(这里给定的条件由lFlowParam给出,根据流程Guid值查询,lTaskParam条件是按照任务状态,只查询出需要处理的任务)
Flow.FlowEngine.GetTasks(lFlowParam, lTaskParam, lTasks);
//Dialogs.Showmessage(SysUtils.IntToStr(lTasks.Count));
if lTasks.Count = 0 then
begin
lDetailForm := TXXXXCKCT.Create(Context);
try
lDetailForm.Showmodal;
finally
lDetailForm.Free;
end;
end
else
SystemCore.TSystemCore.FuncManager.RunTask(SystemCore.TSystemCore.Operator.Positions[0], lTasks[0]);
finally
lFlowParam.Free;
lTaskParam.Free;
lTasks.Free;
end;
end; |