|
你好,我在用x3 时有一个问题:
一个申请保存后,点流转,发生错误:流程未启动,不能填写处理意见
我跟踪了一下午,发现是
这个系统代码 TBIZDETAILFORMDOC.fbMainBeforeFlowOut 运行了两次,正常是运行一次,第一次 FStartUnitListVisible = true, 第二次 FStartUnitListVisible = FALSE
导致 GetBizInfo.AutoGenerateFlowProcessData; 运行而出错
正常运行一次,会执行 TBIZDETAILFORMDOC.fbMainBeforeFlowOut
而 //生成新FFlowID
FFlowID := Business.System.JSCommon.CreateGUIDStr;
Command.FlowValue.IDs.Add(FFlowID);
请帮忙看看,是什么造成运行两次出错
----------------------------------------
procedure TBIZDETAILFORMDOC.fbMainBeforeFlowOut(Sender: TObject; Command: TFlowOutCommand);
var lWarningMsg: string;
begin
FFlowFinished := False;
FFlowArchived := False;
GetBizInfo.SaveBizData;
if (not GetCanFlowOut(lWarningMsg)) then
begin
jsDialogs.ShowWarning(lWarningMsg, '警告');
Command.Accept := False;
exit;
end
else if (not FStartUnitListVisible) and (GetBizInfo.ProcUnitInfo.NeedProcess and (not GetBizInfo.Processed)) then
begin
//if jsDialogs.ConfirmBox('你还没有【处理】,确实要流转吗?', '提示', Business.Forms.Controls.mrCancel) then
if True then
begin
GetBizInfo.AutoGenerateFlowProcessData;
GetBizInfo.SaveBizData;
end
else begin
Command.Accept := False;
exit;
end;
end;
end;
procedure TBIZDETAILFORMDOC.fbMainBeforeFlowStartup(Sender: TObject; Command: TFlowStartupCommand);
var IDIndex: Integer;
begin
//当流程重复处理数据范围不是新建填充,手动生成FFlowID
if (TFT_FUNCLIB.GetFlowRepeatProcessDataMode(Command.FlowControl) <> TRepeatProcessDataMode.rpdmNewAndAutoFill) then
begin
//删除原FlowID
IDIndex := Command.FlowValue.IDs.IndexOf(FFlowID);
if IDIndex > -1 then Command.FlowValue.IDs.Delete(IDIndex);
//生成新FFlowID
FFlowID := Business.System.JSCommon.CreateGUIDStr;
Command.FlowValue.IDs.Add(FFlowID);
end;
end;
procedure TFT_BIZINFO.DataSetsdsProcessBeforeInsert(DataSet: TDataSet);
begin
with DataSetsdsBizMain do
begin
if FieldByName('FFlowID').AsString = '' then
begin
jsDialogs.ShowWarning('流程未启动,不能填写处理意见!', '警告');
SysUtils.Abort;
end;
end;
end; |
|