在做那个入库时,把订单的关闭程序时。

create trigger orderClose
after insert on receive
for each row
begin
set @sum=(select sum(qty) from receive where number=new.number group by number);
set @sumOrder=(select qty from order_info where num=new.number group by num);
if @sum=@sumOrder then
    update order_info set valid="1" where num=new.number;
end if;
end//
drop trigger orderClose//