material_manage_system/internal/model/inventory.go
2026-10-09 11:10:13 +08:00

42 lines
1.5 KiB
Go

package model
import (
"time"
"github.com/shopspring/decimal"
)
// InventoryScope 表示一次库存读写所属的公司、仓库、库位维度。本期每个公司只有一个
// 仓库、每个仓库只有一个库位,这三个维度由服务端按当前公司解析,不接受前端传入,
// 也不回退历史默认公司的仓库、库位。
type InventoryScope struct {
OrganizationID int64
WarehouseID int64
LocationID int64
}
// InventoryBalance is the inventory-domain quantity for one storage dimension.
type InventoryBalance struct {
ID int64 `json:"id"`
OrganizationID int64 `json:"organization_id"`
WarehouseID int64 `json:"warehouse_id"`
LocationID int64 `json:"location_id"`
MaterialID int64 `json:"material_id"`
OnHand decimal.Decimal `json:"on_hand"`
Reserved decimal.Decimal `json:"reserved"`
Locked decimal.Decimal `json:"locked"`
InTransit decimal.Decimal `json:"in_transit"`
Version int `json:"version"`
UpdatedAt time.Time `json:"updated_at"`
}
// StockWarningRule stores an inventory threshold independently of material master data.
type StockWarningRule struct {
ID int64 `json:"id"`
OrganizationID int64 `json:"organization_id"`
WarehouseID int64 `json:"warehouse_id"`
MaterialID int64 `json:"material_id"`
MinimumAvailable decimal.Decimal `json:"minimum_available"`
Enabled bool `json:"enabled"`
}