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

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

-- 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].[Inv_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 Inv_T_TransferLine l
INNER JOIN Inv_T_Transfer t ON t.Id = l.TransferId
LEFT JOIN Inv_T_TransferLineLot z ON z.TransferLineId = l.Id AND z.IsDeleted = 0
WHERE l.IsDeleted = 0 AND t.IsDeleted = 0