table1----发货表
table2----库存表
query1.close;
query1.sql.clear;
query1.sql.add('select product_id'+
' from 库存表'+
' where product_id='''+发货id+''''); //首先你要获得发货的id;
query1.open;
if query1.recourdcount=0 then
show message('库存无货')
else
begin
table1.open;
table1.edit;
table1.append([product_id,....])//在发货表里添加记录;
end;