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.
52 lines
3.0 KiB
52 lines
3.0 KiB
package models
|
|
|
|
import (
|
|
"ims/util/db/dts"
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// InboundType 产品入库类型
|
|
type InboundType int8
|
|
|
|
const (
|
|
InboundSellReturn InboundType = iota + 1 // 销售退货入库
|
|
InboundSellExchange // 销售换货入库
|
|
InboundPremium // 报溢入库 https://help.youzan.com/displaylist/detail_5_5-1-28504
|
|
InboundBorrow // 借入入库
|
|
InboundOpening // 期初入库
|
|
InboundOverage // 盘盈入库
|
|
InboundTransfer // 调拨入库
|
|
InboundDonated // 供应商受赠入库
|
|
InboundOther // 其他
|
|
)
|
|
|
|
// Inbound 产品入库单
|
|
type Inbound struct {
|
|
ID uint `json:"id" gorm:"primarykey"` // 入库ID
|
|
Type InboundType `json:"type"` // 入库类型
|
|
WarehouseID uint `json:"warehouse_id"` // 入库仓库
|
|
Warehouse *Warehouse `json:"warehouse,omitempty" gorm:"foreignkey:WarehouseID"` // 入库仓库
|
|
Quality Quality `json:"quality"` // 品质 - 全部合格、存在不合格品、全不合格
|
|
Images []string `json:"images" gorm:"serializer:json"` // 入库拍照
|
|
InspectorID dts.NullUint `json:"inspector_id"` // 质检员编号
|
|
Inspector *Employee `json:"inspector,omitempty" gorm:"foreignkey:InspectorID"` // 质检员
|
|
InspectedAt time.Time `json:"inspect_time"` // 质检时间
|
|
OperatorID uint `json:"operator_id"` // 入库员编号
|
|
Operator *Employee `json:"operator,omitempty" gorm:"foreignkey:OperatorID"` // 入库员
|
|
OperatedAt time.Time `json:"operate_time"` // 入库时间
|
|
|
|
Items []InboundItem `json:"items,omitempty" gorm:"foreignkey:InboundID"` // 入库单明细列表
|
|
|
|
CreatedBy uint `json:"created_by"` // 创建者(员工编号)
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
UpdatedBy dts.NullUint `json:"updated_by"` // 创建者(员工编号)
|
|
UpdatedAt dts.NullTime `json:"updated_at" gorm:"autoUpdateTime:false"` // 上次操作时间
|
|
DeletedBy dts.NullUint `json:"deleted_by"` // 删除者(员工编号)
|
|
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` // 删除数据时间
|
|
|
|
Creator *Employee `json:"creator,omitempty" gorm:"foreignKey:CreatedBy"` // 创建数据的员工
|
|
Updater *Employee `json:"updater,omitempty" gorm:"foreignKey:UpdatedBy"` // 上次更新数据的员工
|
|
Deleter *Employee `json:"deleter,omitempty" gorm:"foreignKey:DeletedBy"` // 删除数据的员工
|
|
}
|
|
|