package entities import "time" // AdjustmentStock tracks FIFO allocation for stock adjustments // - For INCREASE adjustments (Stockable): Tracks stock added to warehouse // - For DECREASE adjustments (Usable): Tracks stock consumed from warehouse type AdjustmentStock struct { Id uint `gorm:"primaryKey"` StockLogId uint `gorm:"column:stock_log_id;not null;index"` ProductWarehouseId uint `gorm:"column:product_warehouse_id;not null"` // === FIFO FIELDS FOR INCREASE ADJUSTMENT (Stockable) === // Tracks stock added to warehouse via adjustment INCREASE TotalQty float64 `gorm:"column:total_qty;default:0"` // Total lot quantity available TotalUsed float64 `gorm:"column:total_used;default:0"` // Quantity already used from this lot // === FIFO FIELDS FOR DECREASE ADJUSTMENT (Usable) === // Tracks stock consumed from warehouse via adjustment DECREASE UsageQty float64 `gorm:"column:usage_qty;default:0"` // Actual quantity consumed PendingQty float64 `gorm:"column:pending_qty;default:0"` // Pending quantity (waiting for stock) CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"` // Relations StockLog *StockLog `gorm:"foreignKey:StockLogId;references:Id"` ProductWarehouse *ProductWarehouse `gorm:"foreignKey:ProductWarehouseId;references:Id"` }