看过你的代码了,没有什么特殊的,除了把一些长时间的操作放到了事务里,请楼主这样修改一下
1 采用非立即事务
2 把
if not Active then Open;
Last;
DataSetsdsMaterialToPurchase.DisableControls;
DataSetsdsMaterialToPurchase.First;
还有
DataSetsdsMaterialToPurchase.EnableControls;
都放到事务外来处理
======================================
procedure TPURCHASEPLANINFO.ShowPurchasePlanAllocDlg();
var
AHandle: TTransactionHandle;
dlgPurchasePlan: TPurchasePlanAllotDlg;
begin
with DataSetsdsPurchasePlan do
begin
if not Active then Open;
if IsEmpty then Append;
end;
dlgPurchasePlan := TPurchasePlanAllotDlg.Create(self.Context);
try
if (dlgPurchasePlan.ShowModal = Controls.mrOk) then
begin
AHandle := DataSetsdsPurchasePlan.Connection.Transaction.Start(False);
try
with DataSetsdsPurchasePlanDetail do
begin
if not Active then Open;
Last;
DataSetsdsMaterialToPurchase.DisableControls;
DataSetsdsMaterialToPurchase.First;
while not DataSetsdsMaterialToPurchase.eof do
begin
已经在QQ沟通了
1、 采用非立即事务
2 、把
if not Active then Open;
Last;
DataSetsdsMaterialToPurchase.DisableControls;
DataSetsdsMaterialToPurchase.First;
还有
DataSetsdsMaterialToPurchase.EnableControls;
都放到事务外来处理