delphi 事务控制
本文由 猛 于 2022-11-30 18:11 发布在 Delphi
tryDMDATA.GetConByName(LFPD).BeginTrans;
spYFG.First;
while not spYFG.Eof do
begin
TcwDataAccess.OpenStoredProc(DMDATA.GetConByName(LFPD),spQRFG,'P_分批流转信息申请_实排推荐分批',['@客单号','@客单行','@原批次','@原批数量','@分批数量','@申请备注','@申请人','@待生产工序','@待生产工步值','@分批车号'],
[spYFG.FieldByName('客单号').AsString,spYFG.FieldByName('客单行').AsString,spYFG.FieldByName('批号').AsString,spYFG.FieldByName('原数量').AsString,spYFG.FieldByName('分缸数量').AsString,
spYFG.FieldByName('分缸备注').AsString,UserInfo.UserXingMing,spYFG.FieldByName('待生产工序').AsString,spYFG.FieldByName('待生产工步值').AsString,spYFG.FieldByName('分批车号').AsString] );
spYFG.Next;
end;
//最终确定分缸记录
spDFG.Edit;
spDFG.FieldByName('已分缸').Value:=True;
spDFG.Post;
DMDATA.GetConByName(LFPD).CommitTrans;
except
on e:Exception do
begin
DMDATA.GetConByName(LFPD).RollbackTrans;
raise Exception.Create('批量推荐分缸出错+!'+#13+'出错原因:'+e.Message);
end
end;