proc_cancel_po.sql

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

SQL
55
字号
if object_id('dbo.Proc_Cancel_PO') is not null
drop procedure dbo.Proc_Cancel_PO
go

Create procedure Proc_Cancel_PO
  @Order_Number varchar(30) = NULL,
  @Action_type  VARCHAR(30) = NULL,
  @Action_by    varchar(15) = null,
  @Reason       varchar(250) = null,
  @Remark       varchar(250) =null
as

begin
      
	if not exists(select order_number from  Cancel_po_log where order_number =@order_number)
      begin
	insert into Cancel_po_log
	(
	 Order_Number,
	 Action_type,
	 Action_dt,
	 Action_by,
	 Reason,
	 Remark
	)
	values
	(
	 @Order_Number,
	 @Action_type,
	 getdate(),
	 @Action_by,
	 @Reason,
	 @Remark
	)
	if(@action_type ='C')
	begin
		update ord_mst 
			set status ='C'
		where pono = @order_number
	end
	else if(@action_type ='D')
	begin
		update ord_mst 
			set status ='D'
		where pono = @order_number	
	end
	else if(@action_type ='A')
	begin
		update ord_mst 
			set status ='O'
		where pono = @order_number	
	end
   end
end

⌨️ 快捷键说明

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