📄 updinvmg.pas
字号:
unit updINVMG;
interface
uses sysUtils, dbtables, db, bde, updBase;
type
TUpdateINVMG = class(TBaseUpdateUnit)
private
function update_byAll(xSource: Variant): Boolean;
public
function update2(xSource: Variant; xAction: string;
var xMsg: variant; xOtherVar: variant; xUserData: variant): Boolean;
end;
implementation
uses LibStrs;
function TUpdateINVMG.update2(xSource: Variant; xAction: string;
var xMsg: variant; xOtherVar: variant; xUserData: variant): Boolean;
begin
self.saveVar(xAction, xOtherVar, xUserData);
try
self.setDBname(xSource[0]);
Result := update_byAll(xSource)
finally
self.Query1.close;
end;
xMsg := self.Msg;
end;
function TUpdateINVMG.update_byAll(xSource: Variant): Boolean;
var
mExist: Boolean;
begin
Result := True;
self.Msg[0] := 'skip';
self.Msg[1] := 'INVMG';
self.Msg[2] := Format('%s %s ',
[xSource[1], xSource[2]]);
try
with self.Query1 do
begin
close;
SQL.clear;
RequestLive := False;
SQL.add('select * from $$INVMG');
SQL.add(' where MG001=:MG001 and MG002=:MG002 ');
ParamByName('MG001').asString := xSource[1];
ParamByName('MG002').asString := xSource[2];
open;
first;
mExist := not eof;
if ((not mExist) and (self.Action = 'A')) then
begin
close;
SQL.clear;
RequestLive := False;
SQL.add('INSERT INTO $$INVMG (MG001 ,MG002 ,MG003 ,COMPANY ,CREATOR ,USR_GROUP ,CREATE_DATE ,FLAG ) ');
SQL.add('VALUES (:MG001 ,:MG002 ,:MG003 ,:COMPANY ,:CREATOR ,:USR_GROUP ,:CREATE_DATE ,1) ');
ParamByName('MG001').asString := xSource[1];
ParamByName('MG002').asString := xSource[2];
ParamByName('MG003').asString := 'Y';
ParamByName('COMPANY').asString :=self.FCOMPANY;
ParamByName('CREATOR').asString :=self.FCREATOR;
ParamByName('USR_GROUP').asString :=self.FUSR_GROUP;
ParamByName('CREATE_DATE').asString :=self.FCREATE_DATE;
try
TransSqlCommand(Query1);
EXECSQL;
except
on E: EDBEngineError do
begin
if E.Errors[0].ErrorCode <> DBIERR_KEYVIOL then raise
else //糶
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -