SP_Cust_PDA_GetPartName.sql 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. -- ================================================
  2. -- Template generated from Template Explorer using:
  3. -- Create Procedure (New Menu).SQL
  4. --
  5. -- Use the Specify Values for Template Parameters
  6. -- command (Ctrl-Shift-M) to fill in the parameter
  7. -- values below.
  8. --
  9. -- This block of comments will not be included in
  10. -- the definition of the procedure.
  11. -- ================================================
  12. SET ANSI_NULLS ON
  13. GO
  14. SET QUOTED_IDENTIFIER ON
  15. GO
  16. -- =============================================
  17. -- Author: 曹嘉杰
  18. -- Create date: 2022/8/30
  19. -- Description: 查询分包的部件名称
  20. -- =============================================
  21. IF (EXISTS (SELECT * FROM SYS.OBJECTS WHERE NAME = 'SP_Cust_PDA_GetPartName'))
  22. DROP PROC SP_Cust_PDA_GetPartName
  23. GO
  24. CREATE PROCEDURE SP_Cust_PDA_GetPartName
  25. -- Add the parameters for the stored procedure here
  26. @BarCode NVARCHAR(500),
  27. @OrgCode NVARCHAR(50)
  28. AS
  29. BEGIN
  30. -- SET NOCOUNT ON added to prevent extra result sets from
  31. -- interfering with SELECT statements.
  32. SET NOCOUNT ON;
  33. -- Insert statements for procedure here
  34. DECLARE @OrgID AS BIGINT
  35. SELECT @OrgID = ID FROM Base_Organization WHERE Code = @OrgCode
  36. SELECT Segment80 AS PartName
  37. FROM BC_BarCode
  38. WHERE Code = @BarCode
  39. -- AND Org = @OrgID
  40. AND ISNULL(Segment78, 1) <> 1
  41. END
  42. GO
  43. -- EXEC SP_Cust_PDA_GetPartName @BarCode = '11019999-00012-11000000051110-MO-110-2208300001-00001', @OrgCode = '110'