sozsoft-platform/configs/seeds/sql/object/Inv_P_TransferLineAfterSave.sql
2026-10-13 00:43:05 +03:00

21 lines
795 B
Transact-SQL
Raw 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].[Inv_P_TransferLineAfterSave]
@Id uniqueidentifier,
@UserId uniqueidentifier = NULL
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Act nvarchar(16), @Doc uniqueidentifier;
SELECT @Act = PendingAction, @Doc = TransferId FROM Inv_T_TransferLine WHERE Id = @Id;
IF @Act IS NOT NULL
BEGIN
UPDATE Inv_T_TransferLine SET PendingAction = NULL WHERE Id = @Id;
IF @Act = 'GenerateLots'
EXEC Inv_P_TransferLineLotGenerate @Id, @UserId;
ELSE IF @Act = 'AssignLots'
EXEC Inv_P_TransferLineLotAssign @Id, @UserId;
END
EXEC Inv_P_TransferRecalc @Doc;
END