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

123 lines
5.7 KiB
Go
Raw 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 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"
)
// CreateZoneReq 创建库区请求
type CreateZoneReq struct {
g.Meta `path:"/createZone" method:"post" tags:"库区管理" summary:"创建库区" dc:"创建新的库区"`
WarehouseId string `json:"warehouseId" v:"required" dc:"仓库ID"`
ZoneCode string `json:"zoneCode" v:"required|max-length:50#库区编码不能为空|库区编码不能超过50个字符" dc:"库区编码"`
ZoneName string `json:"zoneName" v:"required|max-length:100#库区名称不能为空|库区名称不能超过100个字符" dc:"库区名称"`
ZoneType stock.ZoneType `json:"zoneType" v:"required" dc:"库区类型"`
Capacity int `json:"capacity" dc:"容量"`
Status *stock.ZoneStatus `json:"status" dc:"库区状态(可选,默认启用)"`
Remark string `json:"remark" dc:"备注"`
}
// CreateZoneRes 创建库区响应
type CreateZoneRes struct {
Id *bson.ObjectID `json:"id" dc:"库区ID"`
}
// UpdateZoneReq 更新库区请求
type UpdateZoneReq struct {
g.Meta `path:"/updateZone" method:"put" tags:"库区管理" summary:"更新库区" dc:"更新库区信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库区ID"`
WarehouseId string `json:"warehouseId" dc:"仓库ID"`
ZoneCode string `json:"zoneCode" dc:"库区编码"`
ZoneName string `json:"zoneName" dc:"库区名称"`
ZoneType *stock.ZoneType `json:"zoneType" dc:"库区类型"`
Capacity *int `json:"capacity" dc:"容量"`
Status *stock.ZoneStatus `json:"status" dc:"库区状态"`
Remark string `json:"remark" dc:"备注"`
}
// UpdateZoneRes 更新库区响应
type UpdateZoneRes struct {
Id *bson.ObjectID `json:"id" dc:"库区ID"`
}
// DeleteZoneReq 删除库区请求
type DeleteZoneReq struct {
g.Meta `path:"/deleteZone" method:"delete" tags:"库区管理" summary:"删除库区" dc:"删除库区"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库区ID"`
}
// UpdateZoneStatusReq 更新库区状态请求
type UpdateZoneStatusReq struct {
g.Meta `path:"/updateZoneStatus" method:"put" tags:"库区管理" summary:"更新库区状态" dc:"单独更新库区状态(启用/停用)"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库区ID"`
Status stock.ZoneStatus `json:"status" v:"required|in:enable,disable#状态不能为空|状态值无效" dc:"库区状态"`
}
// DeleteZoneRes 删除库区响应
type DeleteZoneRes struct {
Id *bson.ObjectID `json:"id" dc:"库区ID"`
}
// GetZoneReq 获取库区详情请求
type GetZoneReq struct {
g.Meta `path:"/getZone" method:"get" tags:"库区管理" summary:"获取库区详情" dc:"获取库区详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库区ID"`
}
// GetZoneRes 获取库区详情响应
type GetZoneRes struct {
Id *bson.ObjectID `json:"id" dc:"库区ID"`
WarehouseId string `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneCode string `json:"zoneCode" dc:"库区编码"`
ZoneName string `json:"zoneName" dc:"库区名称"`
ZoneType stock.ZoneType `json:"zoneType" dc:"库区类型"`
ZoneTypeText string `json:"zoneTypeText" dc:"库区类型文本"`
Capacity int `json:"capacity" dc:"容量"`
Status stock.ZoneStatus `json:"status" dc:"库区状态"`
StatusText string `json:"statusText" dc:"状态文本"`
Remark string `json:"remark" dc:"备注"`
LocationCount int `json:"locationCount" dc:"库位数量"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListZoneReq 获取库区列表请求
type ListZoneReq struct {
g.Meta `path:"/listZones" method:"get" tags:"库区管理" summary:"获取库区列表" dc:"分页查询库区列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
WarehouseId string `json:"warehouseId" dc:"仓库ID单个兼容旧版"`
WarehouseIds []string `json:"warehouseIds" dc:"仓库ID列表批量查询"`
ZoneType *stock.ZoneType `json:"zoneType" dc:"库区类型"`
Status *stock.ZoneStatus `json:"status" dc:"库区状态"`
Keyword string `json:"keyword" dc:"关键词搜索(编码/名称)"`
}
// ListZoneRes 获取库区列表响应
type ListZoneRes struct {
List []ZoneListItem `json:"list" dc:"库区列表"`
Total int64 `json:"total" dc:"总数"`
}
// ZoneListItem 库区列表项
type ZoneListItem struct {
Id *bson.ObjectID `json:"id" dc:"库区ID"`
WarehouseId string `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneCode string `json:"zoneCode" dc:"库区编码"`
ZoneName string `json:"zoneName" dc:"库区名称"`
ZoneType stock.ZoneType `json:"zoneType" dc:"库区类型"`
ZoneTypeText string `json:"zoneTypeText" dc:"库区类型文本"`
Capacity int `json:"capacity" dc:"容量"`
Status stock.ZoneStatus `json:"status" dc:"库区状态"`
StatusText string `json:"statusText" dc:"状态文本"`
LocationCount int `json:"locationCount" dc:"库位数量"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}