该批号的入库数量大于委外订单的数量,无法保存

用户在下推委外加工入库时,弹出“该批号的入库数量大于委外订单的数量,无法保存”错误提示。

原因是:入库的并非产品而是物料,物料在系统中不会启用批号管理,故入库时无法填写批号,导致触发器返回错误提示。

处理步骤:
查询该表关联的触发器:

select triggers.name as [触发器],tables.name as [表名],triggers.is_disabled as [是否禁用],
triggers.is_instead_of_trigger AS [触发器类型],
case when triggers.is_instead_of_trigger = 1 then 'INSTEAD OF'
when triggers.is_instead_of_trigger = 0 then 'AFTER'
else null
end as [触发器类型描述]
from sys.triggers triggers
inner join sys.tables tables on triggers.parent_id = tables.object_id
where triggers.type ='TR' AND triggers.name LIKE 'ICStockBil%' 
order by triggers.create_date

找到两条相关,但不知道是哪一条。查看触发器信息信息:

EXEC sp_helptext ICStockBill_UPDATE
EXEC sp_helptext ICStockBill_Related

发现触发器内ICStockBill_UPDATE内有对应的错误提示。无疑。

临时关闭该触发器,通知生管推单后再开启。

--开启
ALTER TABLE ICStockBill ENABLE  TRIGGER ICStockBill_Related
--关闭
ALTER TABLE ICStockBill DISABLE TRIGGER ICStockBill_Related

猜你喜欢

转载自blog.csdn.net/lglglgl/article/details/80435795