
/****** Object:  StoredProcedure [dbo].[API_WMSRemoveDocWMS]    Script Date: 07.09.2021 13:58:35 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[API_WMSRemoveDocWMS]
	 @ID as INT
	
AS 
BEGIN
declare @ObjectId int;
declare @ObjectType int;
--set @ObjectId = 5098;
select @ObjectId =ObjectId, @ObjectType = ObjectType from dbo.ApiWmsDocuments where OrgDocumentNumber LIKE '%[C]%'

delete dbo.ApiSyncItems where ObjectId = @ObjectId and ObjectType = 40 and  Message='CANCEL';

delete dbo.ApiWmsDocLines where DocumentId =@ID
delete dbo.ApiWmsDocuments where  Id = @ID
END
GO


