Files
assets/model/dto/stock/warehouse_dto.go

116 lines
5.6 KiB
Go
Raw Normal View History

2026-03-18 10:18:03 +08:00
package dto
import (
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// CreateWarehouseReq 创建仓库请求
type CreateWarehouseReq struct {
g.Meta `path:"/createWarehouse" method:"post" tags:"仓库管理" summary:"创建仓库" dc:"创建新的仓库"`
WarehouseCode string `json:"warehouseCode" v:"required|max-length:50#仓库编码不能为空|仓库编码不能超过50个字符" dc:"仓库编码"`
WarehouseName string `json:"warehouseName" v:"required|max-length:100#仓库名称不能为空|仓库名称不能超过100个字符" dc:"仓库名称"`
Address string `json:"address" dc:"仓库地址"`
ContactPerson string `json:"contactPerson" dc:"联系人"`
ContactPhone string `json:"contactPhone" dc:"联系电话"`
Status *stock.WarehouseStatus `json:"status" dc:"仓库状态(可选,默认启用)"`
Remark string `json:"remark" dc:"备注"`
}
// CreateWarehouseRes 创建仓库响应
type CreateWarehouseRes struct {
Id *bson.ObjectID `json:"id" dc:"仓库ID"`
}
// UpdateWarehouseReq 更新仓库请求
type UpdateWarehouseReq struct {
g.Meta `path:"/updateWarehouse" method:"put" tags:"仓库管理" summary:"更新仓库" dc:"更新仓库信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"仓库ID"`
WarehouseCode string `json:"warehouseCode" dc:"仓库编码"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
Address string `json:"address" dc:"仓库地址"`
ContactPerson string `json:"contactPerson" dc:"联系人"`
ContactPhone string `json:"contactPhone" dc:"联系电话"`
Status *stock.WarehouseStatus `json:"status" dc:"仓库状态"`
Remark string `json:"remark" dc:"备注"`
}
// UpdateWarehouseRes 更新仓库响应
type UpdateWarehouseRes struct {
Id *bson.ObjectID `json:"id" dc:"仓库ID"`
}
// DeleteWarehouseReq 删除仓库请求
type DeleteWarehouseReq struct {
g.Meta `path:"/deleteWarehouse" method:"delete" tags:"仓库管理" summary:"删除仓库" dc:"删除仓库"`
Id *bson.ObjectID `json:"id" v:"required" dc:"仓库ID"`
}
// UpdateWarehouseStatusReq 更新仓库状态请求
type UpdateWarehouseStatusReq struct {
g.Meta `path:"/updateWarehouseStatus" method:"put" tags:"仓库管理" summary:"更新仓库状态" dc:"单独更新仓库状态(启用/停用)"`
Id *bson.ObjectID `json:"id" v:"required" dc:"仓库ID"`
Status stock.WarehouseStatus `json:"status" v:"required|in:enable,disable#状态不能为空|状态值无效" dc:"仓库状态"`
}
// DeleteWarehouseRes 删除仓库响应
type DeleteWarehouseRes struct {
Id *bson.ObjectID `json:"id" dc:"仓库ID"`
}
// GetWarehouseReq 获取仓库详情请求
type GetWarehouseReq struct {
g.Meta `path:"/getWarehouse" method:"get" tags:"仓库管理" summary:"获取仓库详情" dc:"获取仓库详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"仓库ID"`
}
// GetWarehouseRes 获取仓库详情响应
type GetWarehouseRes struct {
Id *bson.ObjectID `json:"id" dc:"仓库ID"`
WarehouseCode string `json:"warehouseCode" dc:"仓库编码"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
Address string `json:"address" dc:"仓库地址"`
ContactPerson string `json:"contactPerson" dc:"联系人"`
ContactPhone string `json:"contactPhone" dc:"联系电话"`
Status stock.WarehouseStatus `json:"status" dc:"仓库状态"`
StatusText string `json:"statusText" dc:"状态文本"`
Remark string `json:"remark" dc:"备注"`
ZoneCount int `json:"zoneCount" dc:"库区数量"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListWarehouseReq 获取仓库列表请求
type ListWarehouseReq struct {
g.Meta `path:"/listWarehouses" method:"get" tags:"仓库管理" summary:"获取仓库列表" dc:"分页查询仓库列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
Status *stock.WarehouseStatus `json:"status" dc:"仓库状态"`
Keyword string `json:"keyword" dc:"关键词搜索(编码/名称)"`
}
// ListWarehouseRes 获取仓库列表响应
type ListWarehouseRes struct {
List []WarehouseListItem `json:"list" dc:"仓库列表"`
Total int64 `json:"total" dc:"总数"`
}
// WarehouseListItem 仓库列表项
type WarehouseListItem struct {
Id *bson.ObjectID `json:"id" dc:"仓库ID"`
WarehouseCode string `json:"warehouseCode" dc:"仓库编码"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
Address string `json:"address" dc:"仓库地址"`
ContactPerson string `json:"contactPerson" dc:"联系人"`
ContactPhone string `json:"contactPhone" dc:"联系电话"`
Status stock.WarehouseStatus `json:"status" dc:"仓库状态"`
StatusText string `json:"statusText" dc:"状态文本"`
ZoneCount int `json:"zoneCount" dc:"库区数量"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}