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

11 lines
906 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.

-- Hareketler: bütün operasyon türlerinin satırları ortak kolonlarla, lot/seri dağılımı varsa lot başına bir satır.
-- Miktar yapılan miktardır (lotlu satırda lotun miktarı); Talep satırın talep miktarıdır.
CREATE OR ALTER VIEW [dbo].[Stk_V_StockMove] AS
SELECT COALESCE(z.Id, l.Id) AS Id, l.TenantId, t.Id AS TransferId, t.TransferNo, t.OperationKind, t.OperationTypeId, t.Status,
COALESCE(t.EffectiveDate, t.ScheduledDate) AS MoveDate, t.BranchId, t.WarehouseId,
t.SourceLocationId, t.DestinationLocationId, t.PartnerId, t.SourceDocument,
l.ProductId, COALESCE(z.LotNo, '') AS LotNo, l.DemandQuantity, COALESCE(z.Quantity, l.Quantity) AS Quantity, l.UomId
FROM Stk_T_TransferLine l
INNER JOIN Stk_T_Transfer t ON t.Id = l.TransferId
LEFT JOIN Stk_T_TransferLineLot z ON z.TransferLineId = l.Id AND z.IsDeleted = 0
WHERE l.IsDeleted = 0 AND t.IsDeleted = 0