You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
3.0 KiB
56 lines
3.0 KiB
2 months ago
|
package models
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
// OutboundReason 产品出库类型
|
||
|
type OutboundReason int8
|
||
|
|
||
|
const (
|
||
|
OutboundSellExchangeOut OutboundReason = iota + 1 // 销售换货出库
|
||
|
OutboundPurchaseReturn // 采购退货出库
|
||
|
OutboundBreakage // 报损出库
|
||
|
OutboundLend // 借出出库
|
||
|
OutboundLendSend // 借出直发出库
|
||
|
OutboundInventoryLosses // 盘亏出库
|
||
|
OutboundTransfer // 调拨出库
|
||
|
OutboundTransferFailed // 调拨异常处理
|
||
|
OutboundGift // 销售赠品出库
|
||
|
OutboundOther // 其他
|
||
|
)
|
||
|
|
||
|
// OutboundTag 出库标签
|
||
|
type OutboundTag int8
|
||
|
|
||
|
const (
|
||
|
_ OutboundTag = iota + 1 // 出库
|
||
|
_ // 库存冻结
|
||
|
_ // 计划出库
|
||
|
)
|
||
|
|
||
|
// Outbound 产品出库单
|
||
|
type Outbound struct {
|
||
|
ID uint `json:"id" gorm:"primarykey"` // 出库单编号
|
||
|
Reason OutboundReason `json:"reason"` // 出库原因
|
||
|
Remark string `json:"remark"` // 备注信息
|
||
|
WarehouseID uint `json:"warehouse_id"` // 出库仓库
|
||
|
Warehouse *Warehouse `json:"warehouse,omitempty" gorm:"foreignkey:WarehouseID"` // 出库仓库
|
||
|
Images []string `json:"images" gorm:"serializer:json"` // 出库拍照
|
||
|
Tag OutboundTag `json:"tag"` // 出库标签
|
||
|
Address *Address `json:"address" gorm:"polymorphic:Owner;polymorphicValue:outbound"` // 收货地址
|
||
|
CustomerID uint `json:"customer_id"` // 收货客户编号
|
||
|
Customer *Customer `json:"customer" gorm:"foreignkey:CustomerID"` // 收货客户
|
||
|
IsTaken bool `json:"is_taken"` // 客户是否收货
|
||
|
OperatorID uint `json:"operator_id"` // 出库员编号
|
||
|
Operator *Employee `json:"operator,omitempty" gorm:"foreignkey:OperatorID"` // 出库员
|
||
|
OperatedAt time.Time `json:"operate_time"` // 出库时间
|
||
|
CreatedAt time.Time `json:"create_time"` // 创建时间
|
||
|
UpdatedAt time.Time `json:"update_time"` // 上次操作时间
|
||
|
DeletedAt gorm.DeletedAt `json:"delete_time" gorm:"index"` // 删除数据的时间
|
||
|
|
||
|
Items []OutboundItem `json:"items,omitempty" gorm:"foreignkey:OutboundID"` // 出库单明细列表
|
||
|
}
|