|
发表于 2010-7-7 23:43:26
|
显示全部楼层
create trigger ufidafans_bydd on rdrecords
for insert ,update
as
--*******************产成品入库或材料出库必有订单*********************--
--******************************************************************--
declare @cmocode varchar(20) ,
@id int,
@cVouchType varchar(20),
@cBusType varchar(20)
select @id=id,@cmocode=isnull(cmocode,'') from inserted
select @cvouchtype=cvouchtype,@cbustype=cbustype from rdrecord where id=@id
if (@cvouchtype='10' or @cvouchtype='11') and (@cbustype='成品入库' or @cbustype='领料') and @cmocode=''
begin
raiserror('抱歉!请立即与生产部门联系,产成
品入库或材料出库必须要有生产订单'
,12,1)
rollback transaction |
|