可以在这三个环节回退时候(AfterFlowBack),找到属于这三个环节的任务和任务消息,置状态为取消状态
procedure TMainForm.FlowBroker1AfterFlowBack(Sender: TObject; Command: TFlowBackCommand);
var
i, j: Integer;
lTask: TTask;
begin
for i:=0 to FlowBroker1.FlowControl.Flow.Tasks.Count-1 do
begin
lTask := FlowBroker1.FlowControl.Flow.Tasks;
if ((lTask.ProcUnitID = 'QXRWHJ')
or (lTask.ProcUnitID='QXRWHJ1')
or (lTask.ProcUnitID='QXRWHJ2'))
and (lTask.State in Task.SUnFinishedTaskStates) then
begin
for j := 0 to lTask.TaskMessages.Count-1 do
if lTask.TaskMessages[j].State in Task.SUnFinishedTaskMessageStates then
lTask.TaskMessages[j].State := TTaskMessageState.tmsCanceled;