资产增加批次库存管理模式

This commit is contained in:
2026-01-04 12:20:45 +08:00
parent 1ce24a84cd
commit 30eb8bcf89
3 changed files with 69 additions and 15 deletions

View File

@@ -32,9 +32,19 @@ type OrderItemReq struct {
// OrderItemStockReq 创建订单商品项库存明细请求
type OrderItemStockReq struct {
StockID string `json:"stock_id" binding:"required"` // 库存ID
Price int64 `json:"price" binding:"required,min=1"` // 单价(分)
StockAttrs map[string]interface{} `json:"stock_attrs"` // 库存项属性(动态字段
// 库存ID(明细模式必填,批次模式为空)
StockID string `json:"stock_id,omitempty"` // 库存ID
// 批次信息(批次模式必填,明细模式为空
BatchID string `json:"batch_id,omitempty"` // 批次ID
BatchNo string `json:"batch_no,omitempty"` // 批次号
// 数量
Quantity int `json:"quantity" binding:"required,min=1"` // 使用数量
// 价格信息
Price int64 `json:"price" binding:"required,min=1"` // 单价(分)
// 库存管理模式
StockMode int `json:"stock_mode" binding:"required"` // 库存管理模式1-明细模式2-批次模式
// 库存项属性
StockAttrs map[string]interface{} `json:"stock_attrs"` // 库存项属性(动态字段)
}
// ShippingInfoReq 收货信息请求
@@ -136,8 +146,18 @@ type OrderItem struct {
// OrderItemStock 订单商品项库存明细(响应)
type OrderItemStock struct {
StockID string `json:"stock_id"` // 库存ID
Price int64 `json:"price"` // 单价(分)
// 库存ID(明细模式)
StockID string `json:"stock_id,omitempty"` // 库存ID
// 批次信息(批次模式)
BatchID string `json:"batch_id,omitempty"` // 批次ID
BatchNo string `json:"batch_no,omitempty"` // 批次号
// 数量
Quantity int `json:"quantity"` // 使用数量
// 价格信息
Price int64 `json:"price"` // 单价(分)
// 库存管理模式
StockMode int `json:"stock_mode"` // 库存管理模式1-明细模式2-批次模式
// 库存项属性
StockAttrs map[string]interface{} `json:"stock_attrs"` // 库存项属性(动态字段)
}

View File

@@ -40,11 +40,28 @@ type OrderItem struct {
}
// OrderItemStock 订单商品项库存明细
// 用于追溯具体使用了哪些库存项,一个库存项只会有一个实例
// 用于追溯具体使用了哪些库存项,支持明细模式和批次模式
// 明细模式一个库存项对应一条记录数量固定为1
// 批次模式:一个批次记录可以包含多个数量
type OrderItemStock struct {
StockID string `bson:"stock_id" json:"stock_id"` // 库存ID
Price int64 `bson:"price" json:"price"` // 该库存项的单价(分)
StockAttrs map[string]interface{} `bson:"stock_attrs,omitempty" json:"stock_attrs"` // 库存项属性(动态字段,存储该库存项的具体规格属性)
// 库存ID(明细模式必填,批次模式为空)
StockID string `bson:"stock_id,omitempty" json:"stock_id,omitempty"`
// 批次信息(批次模式必填,明细模式为空)
BatchID string `bson:"batch_id,omitempty" json:"batch_id,omitempty"` // 批次ID
BatchNo string `bson:"batch_no,omitempty" json:"batch_no,omitempty"` // 批次号
// 数量明细模式固定为1批次模式可以>1
Quantity int `bson:"quantity" json:"quantity"` // 使用数量
// 价格信息
Price int64 `bson:"price" json:"price"` // 该库存项的单价(分)
// 库存管理模式
StockMode int `bson:"stock_mode" json:"stock_mode"` // 库存管理模式1-明细模式2-批次模式
// 库存项属性(动态字段,存储该库存项的具体规格属性)
StockAttrs map[string]interface{} `bson:"stock_attrs,omitempty" json:"stock_attrs,omitempty"`
}
// ShippingInfo 收货信息