try
lvForm:=TSRMM.Create(context);
if lvForm.ShowModal=Business.Forms.Controls.mrOk then
begin
query2.Close;
query2.Open;
query2.Edit;
query1.First;
while not query1.Eof do
begin
with query2 do
begin
insert;
FieldByName('SERIES').AsString:=query1.FieldByName('SERIES').AsString;
FieldByName('JOBNO').AsString:=query1.FieldByName('JOBNO').AsString;
FieldByName('PCNO').AsString:=query1.FieldByName('PCNO').AsString;
FieldByName('PKNO').AsString:=query1.FieldByName('PKNO').AsString;
FieldByName('KG').AsFloat:=query1.FieldByName('KG').AsFloat;
FieldByName('YARD').AsFloat:=query1.FieldByName('YARD').AsFloat;
FieldByName('LB').AsFloat:=query1.FieldByName('LB').AsFloat;
FieldByName('METER').AsFloat:=query1.FieldByName('METER').AsFloat;
FieldByName('COLORRGB').AsString:=query1.FieldByName('COLORRGB').AsString;
FieldByName('ADJUST').AsString:=query1.FieldByName('ADJUST').AsString;
FieldByName('PACKTIME').AsDateTime:=query1.FieldByName('PACKTIME').AsDateTime;
FieldByName('STATUS').AsString:=query1.FieldByName('STATUS').AsString;
FieldByName('STOWTYPE').AsString:=query1.FieldByName('STOWTYPE').AsString;
FieldByName('STOWAGE').AsString:=query1.FieldByName('STOWAGE').AsString;
FieldByName('FABNO').AsString:=query1.FieldByName('FABNO').AsString;
FieldByName('PARKNO').AsString:=query1.FieldByName('PARKNO').AsString;
FieldByName('PARKSEQ').AsString:=query1.FieldByName('PARKSEQ').AsString;
FieldByName('DELNO').AsString:=query1.FieldByName('DELNO').AsString;
FieldByName('DELSEQ').AsString:=query1.FieldByName('DELSEQ').AsString;
FieldByName('DEFECT').AsString:=query1.FieldByName('DEFECT').AsString;
FieldByName('RATE').AsString:=query1.FieldByName('RATE').AsString;
FieldByName('NEEDFABRIC').AsString:=query1.FieldByName('NEEDFABRIC').AsString;
FieldByName('LAYOUT').AsString:=query1.FieldByName('LAYOUT').AsString;
FieldByName('CLASSNO').AsString:=query1.FieldByName('CLASSNO').AsString;
FieldByName('SHIFT').AsString:=query1.FieldByName('SHIFT').AsString;
FieldByName('DEPOT').AsString:=query1.FieldByName('DEPOT').AsString;
FieldByName('ISDEF').AsString:=query1.FieldByName('ISDEF').AsString;
FieldByName('SEQNO').AsString:=query1.FieldByName('SEQNO').AsString;
FieldByName('stuffNO').AsString:=query1.FieldByName('stuffNO').AsString;
FieldByName('shelf').AsString:=query1.FieldByName('shelf').AsString;
FieldByName('defpoint').AsString:=query1.FieldByName('defpoint').AsString;
FieldByName('MEMO').AsString:=query1.FieldByName('MEMO').AsString;
//FieldByName('DEFPOINTS').AsInteger:=query1.FieldByName('DEFPOINTS').AsInteger;
end;
query1.Next;
end ;
query2.update
query2.ApplyUpdates;
v_sql:='delete from ledwaybc.cxd where (delno is not null) and ledwaybc.cxd.packtime between '''+FormatDateTime('yyyy-mm-dd hh:mm:ss',packtime1.DateTime)+''' and '''+FormatDateTime('yyyy-mm-dd hh:mm:ss',packtime2.DateTime)+'''';
v_flag:= Connection1.ExecuteSQL(v_sql);
//dialogs.ShowMessage(sysutils.IntToStr(v_flag));
lContextCurrent:=TContextCurrent.Create(Context);
displayname:=lContextCurrent.Operator.DisplayName;
if v_flag<>-1 then
begin
v_sql:='insert into dbo.htt_deletedetail(username,demo) values('''+displayname+''',''备份server185成功'')' ;
connection1.ExecuteSQL(v_sql);
dialogs.ShowMessage('备份成功,删除成功') ;
end
else
begin
v_sql:='insert into dbo.htt_deletedetail(username,demo) values('''+displayname+''',''备份server185成功'')' ;
connection1.ExecuteSQL(v_sql);
dialogs.ShowMessage('备份成功,删除成功') ;
end;
end;
finally
lvForm.Free
end ;
end;
我想查看query1有没有更新成功 |