关于回收 可以确定3109版本是好的
对于你的3012版本,你可以 打开 业务模型\系统空间\系统运行库\系统核心库 参考下面的处理试试是否可以解决。(因为升级的话总是有一定的风险和一定的工作量的)
增加函数
procedure TFuncManager.SetCurrentTaskState(AFlowControl: TFlowControl; AExecutor: TOrgURL);
var
I: Integer;
begin
for I := 0 to AFlowControl.CurrentTask.TaskMessages.Count -1 do
with AFlowControl.CurrentTask.TaskMessages[I] do
if SysUtils.SameText(ReceiverDeptID, AExecutor.DeptID)
and SysUtils.SameText(ReceiverPositionID, AExecutor.PositionID)
and SysUtils.SameText(ReceiverID, AExecutor.PersonID) then
begin
State := TTaskMessageState.tmsReceived;
AFlowControl.CurrentTask.SaveToDB;
Break;
end;
end;
调用
function TFuncManager.RunFunc(AContext: TContext; AFuncItem: TOperatorFuncItem; const AParams, AUniqueID: string; BeforeRunFunc: TFuncNotifyEvent; Modal: Boolean): TFunc;
const
ErrMsg = '当前操作者不具备运行该功能的权限,请向管理员询问';
var
S: string;
lRealFuncURL: TBizURL;
lPosition: TOperatorPosition;
lProcURL: TBizURL;
lProc: TProc;
lEntryID: string;
lFlowControl: TFlowControl;
lOrgURL: TOrgURL;
I: Integer;
begin
// 这里运行支持扩展空间的机制
// 流程使用扩展空间的规则:流程需要扩展,并且入口功能也需要扩展
lRealFuncURL := BizSys.ObjectInfoFromURL(BizSys.BizService.GetFixURL(AFuncItem.FuncURL.URL)).BizURL;
S := AUniqueID;
if S = '' then
S := GetFuncUniqueID(AContext, lRealFuncURL.URL, AParams);
Result := FindRunning(S);
if Result <> nil then
begin
ActivateFunc(Result);
Exit;
end;
if not AFuncItem.IsProcEntry then
Result := InternalRunFunc(AContext, lRealFuncURL.URL, AParams, S, BeforeRunFunc, Modal)
else
begin
// 流程这里采取了扩展空间的机制
lPosition := TContextUtils.GetOperatorPosition(AContext);
lProcURL := TBizURL.Create;
try
lProcURL.URL := BizSys.BizService.GetFixURL(AFuncItem.ProcURL.URL);
lProc := TSystemCore.GetBizObjectEx(AContext, lProcURL.URL, '') as TProc;
lFlowControl := TFlowControl.Create(AContext);
try
lEntryID := lProc.GetEntryUnitByFuncURL(lRealFuncURL).ID;
// 不能使用AFuncItem的OrgURL,因为它不一定是人员成员
lOrgURL := TOrgURL.Create(lPosition.PositionMember.Parent.ID,
lPosition.PositionMember.ID, lPosition.PersonMember.ID);
try
lFlowControl.ExecuteFlow(lProcURL, lEntryID, lOrgURL);
[B] SetCurrentTaskState(lFlowControl, lOrgURL);[/B] finally
lOrgURL.Free;
end;
Result := CreateFunc(lFlowControl.Context, lRealFuncURL.URL);
try
lFlowControl.Func := Result;
InternalRunFunc(Result, AParams, S, BeforeRunFunc, Modal);
except
Result.Free;
raise;
end;
except
lFlowControl.Free;
raise;
end;
finally
lProcURL.Free;
end;
end;
end; |