sozsoft-platform/configs/seeds/sql/object/Stk_P_TransferLineAfterSave.sql
2026-10-19 17:35:08 +03:00

21 lines
795 B
Transact-SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Hareket satırı kaydı sonrası: satırın araç çubuğu işlemi (GenerateLots = Lot/Seri Oluştur, AssignLots = Otomatik Ata) ve belge özeti.
CREATE OR ALTER PROCEDURE [dbo].[Stk_P_TransferLineAfterSave]
@Id uniqueidentifier,
@UserId uniqueidentifier = NULL
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Act nvarchar(16), @Doc uniqueidentifier;
SELECT @Act = PendingAction, @Doc = TransferId FROM Stk_T_TransferLine WHERE Id = @Id;
IF @Act IS NOT NULL
BEGIN
UPDATE Stk_T_TransferLine SET PendingAction = NULL WHERE Id = @Id;
IF @Act = 'GenerateLots'
EXEC Stk_P_TransferLineLotGenerate @Id, @UserId;
ELSE IF @Act = 'AssignLots'
EXEC Stk_P_TransferLineLotAssign @Id, @UserId;
END
EXEC Stk_P_TransferRecalc @Doc;
END