proc_ord_qty_add.sql

来自「工厂采购系统,DELPHI+SQL SERVER,三层技术」· SQL 代码 · 共 35 行

SQL
35
字号

if object_id('dbo.Proc_Ord_Qty_Add') is not null
drop procedure dbo.Proc_Ord_Qty_Add
go

Create Procedure Proc_Ord_Qty_Add
@pono varchar(30) = null,
@Qty  numeric(18,2) = 0.0,
@itemseq int	= null
as
declare
  @old_qty numeric(18,2) 

  select @old_qty = isnull(quantity,0) from ord_item
	where pono =@pono and itemseq =@itemseq and iscom ='Y'

  if(@Qty >@old_qty)
 begin
	update ord_item
		set iscom ='N'
	where pono =@pono and itemseq =@itemseq
 end

 if exists(select  pono from ord_mst where pono =@pono
 and completed ='YES' or status = 'F')
 begin
	update ord_mst 
		set completed ='NO',
		    status = 'O'
	where pono =@pono
 end



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?