mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
812db3f79e
- Added FIFO service integration in the adjustments module to manage stockable and usable items for adjustments. - Created a new repository for adjustment stocks to handle database operations. - Enhanced the adjustment service to track stock adjustments using FIFO logic for both increase and decrease operations. - Updated product warehouse DTOs and repositories to include project flock information. - Implemented FIFO logic in the transfer module to manage stock transfers between warehouses. - Added integration tests for FIFO operations in stock transfers, ensuring correct stock consumption and replenishment.
35 lines
1.5 KiB
Go
35 lines
1.5 KiB
Go
package entities
|
|
|
|
import "time"
|
|
|
|
// DETAIL PRODUK
|
|
type StockTransferDetail struct {
|
|
Id uint64 `gorm:"primaryKey;autoIncrement"`
|
|
StockTransferId uint64
|
|
ProductId uint64
|
|
|
|
// === FIFO FIELDS - SOURCE WAREHOUSE (Usable) ===
|
|
// Tracking stock yang DIAMBIL dari source warehouse
|
|
SourceProductWarehouseID *uint64 `gorm:"column:source_product_warehouse_id"`
|
|
UsageQty float64 `gorm:"column:usage_qty;default:0"` // Actual yang berhasil diambil
|
|
PendingQty float64 `gorm:"column:pending_qty;default:0"` // Yang pending (nunggu stock)
|
|
|
|
// === FIFO FIELDS - DESTINATION WAREHOUSE (Stockable) ===
|
|
// Tracking stock yang DITAMBAHKAN ke destination warehouse
|
|
DestProductWarehouseID *uint64 `gorm:"column:dest_product_warehouse_id"`
|
|
TotalQty float64 `gorm:"column:total_qty;default:0"` // Total lot yang tersedia
|
|
TotalUsed float64 `gorm:"column:total_used;default:0"` // Yang sudah dipakai dari lot ini
|
|
|
|
// === METADATA ===
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
DeletedAt *time.Time `gorm:"index"`
|
|
|
|
// === RELATIONS ===
|
|
StockTransfer *StockTransfer `gorm:"foreignKey:StockTransferId"`
|
|
Product *Product `gorm:"foreignKey:ProductId"`
|
|
SourceProductWarehouse *ProductWarehouse `gorm:"foreignKey:SourceProductWarehouseID"`
|
|
DestProductWarehouse *ProductWarehouse `gorm:"foreignKey:DestProductWarehouseID"`
|
|
DeliveryItems []StockTransferDeliveryItem `gorm:"foreignKey:StockTransferDetailId"`
|
|
}
|