Files
assets/model/entity/stock/private_stock.go
2026-03-18 10:18:03 +08:00

57 lines
3.2 KiB
Go
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.
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PrivateStock 实物库存批次记录SKU批次在具体仓库/库区/库位的实际存放位置和数量)
type PrivateStock struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息 - 支持多种库存类型
StockType stock.StockLocationType `bson:"stockType" json:"stockType"` // 库存类型stock_details/private_stock/stock_batch
// 位置信息
WarehouseID *bson.ObjectID `bson:"warehouseId" json:"warehouseId"` // 仓库ID
WarehouseCode string `bson:"warehouseCode" json:"warehouseCode"` // 仓库编码
WarehouseName string `bson:"warehouseName" json:"warehouseName"` // 仓库名称
ZoneID *bson.ObjectID `bson:"zoneId" json:"zoneId"` // 库区ID可选
ZoneCode string `bson:"zoneCode" json:"zoneCode"` // 库区编码
ZoneName string `bson:"zoneName" json:"zoneName"` // 库区名称
ZoneType stock.ZoneType `bson:"zoneType" json:"zoneType"` // 库区类型
LocationID *bson.ObjectID `bson:"locationId" json:"locationId"` // 库位ID可选
LocationCode string `bson:"locationCode" json:"locationCode"` // 库位编码
LocationName string `bson:"locationName" json:"locationName"` // 库位名称
LocationType stock.LocationType `bson:"locationType" json:"locationType"` // 库位类型
PrivateSkuID *bson.ObjectID `bson:"privateSkuId" json:"privateSkuId"` // 私域SKU ID
BatchNo string `bson:"batchNo" json:"batchNo"` // 批次号
BatchQty int `bson:"batchQty" json:"batchQty"` // 批次总数量(入库后不可变)
AvailableQty int `bson:"availableQty" json:"availableQty"` // 可用数量(实时变化)
// 状态
BatchStatus stock.BatchStatus `bson:"batchStatus" json:"batchStatus"` // 批次状态
// 订单关联
OrderID *bson.ObjectID `bson:"orderId" json:"orderId"` // 关联订单ID如果有
// 供应商关联和临期管理
SupplierID *bson.ObjectID `bson:"supplierId" json:"supplierId"` // 关联供应商ID
SupportsRecycle bool `bson:"supportsRecycle" json:"supportsRecycle"` // 是否支持回收
ProductionDate *gtime.Time `bson:"productionDate" json:"productionDate"` // 生产日期
ExpiryDate *gtime.Time `bson:"expiryDate" json:"expiryDate"` // 过期日期
ExpiryWarningDate *gtime.Time `bson:"expiryWarningDate" json:"expiryWarningDate"` // 临期预警时间(有过期日期时建议填写)
PrivateCategoryPath string `bson:"privateCategoryPath" json:"privateCategoryPath"` // 私域分类路径
StockStatus stock.StockStatus `bson:"stockStatus" json:"stockStatus"` // 库存状态
LastMovedAt *gtime.Time `bson:"lastMovedAt" json:"lastMovedAt"` // 最后移动时间
}
// CollectionName 获取集合名称
func (PrivateStock) CollectionName() string {
return public.PrivateStockCollection
}