|
轩辕小珂 发表于 2014-7-12 15:39 ![]()
我猜是有的。看看你更新的这个语句
update t_systemprofile set fvalue='1' where fcategory='ic' and f ...
帮我看看这样写行不?谢谢!
--领料单保存时检查库存,不足不能保存
ALTER trigger [dbo].[trig10] on [dbo].[ICStockBill]
FOR INSERT, UPDATE
NOT FOR REPLICATION
AS
DECLARE @fitemid int
DECLARE @fbatchno varchar(50)
DECLARE @fqty decimal(18,6)
DECLARE @fname varchar(50)
DECLARE @sumqty decimal(18,6)
select @fitemid = fitemid, @fbatchno = isnull(fbatchno,''), @fqty = fqty from inserted where ftrantype = '24'
set @sumqty = isnull((select sum(fqty) from ICInventory where fitemid = @fitemid and fbatchno = @fbatchno),0)
if @fqty > @sumqty
begin
select @fname = fname from t_icitem where fitemid = @fitemid
ROLLBACK TRAN
RAISERROR('此单据货品 %s (%s),超库存!',18,18, @fname, @fbatchno)
end |
|