📄 6.pr_inv_update.sql
字号:
/*----本存储过程pr_inv_update用于触发器tr_inv_insert------ */
/*功能:更新在手数量、金额、在手辅助量、如果是出货单或退货单,还要更新货的待发量*/
/*参数1:公司ID */
/*参数2:货品ID */
/*参数3:仓库ID */
/*参数4:货品计量单位 */
/*参数5:年 */
/*参数6:月 */
/*作者:吕勇 */
/*日期:2006-04-10 */
/*版本:v1.0 */
/*修改人: */
/*修改日期: */
GO
IF EXISTS(SELECT name FROM sysobjects
WHERE name = 'pr_inv_update' AND type = 'P')
DROP PROCEDURE pr_inv_update
GO
GO
CREATE PROCEDURE pr_inv_update
@ls_direct char(1),
@ls_corpid char(36),
@ls_part char(16),
@ls_prloc char(30),
@ls_uom varchar(10),
@ldb_updqty numeric(12,4),
@ldb_acramt numeric(12,4),
@ls_billtype char(3) = 'oth'
WITH ENCRYPTION
AS
declare @ll_rtn int
select @ll_rtn = 0
if @ls_direct = '-'
begin
--更新库存档案
update f_storepart set i_onhand = i_onhand - @ldb_updqty,i_onhandmoney = i_onhandmoney - @ldb_acramt
where c_corporationid = @ls_corpid and c_part = @ls_part and c_prloc =@ls_prloc
if @@error <> 0 or @ll_rtn <> 0
begin
rollback tran
return
end
end
else if @ls_direct = '+'
begin
--更新库存档案
update f_storepart set i_onhand = i_onhand + @ldb_updqty,i_onhandmoney = i_onhandmoney + @ldb_acramt
where c_corporationid = @ls_corpid and c_part = @ls_part and c_prloc =@ls_prloc
if @@error <> 0 or @ll_rtn <> 0
begin
rollback tran
return
end
end
GO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -