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

137 lines
7.5 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"
)
// CreateLocationReq 创建库位请求
type CreateLocationReq struct {
g.Meta `path:"/createLocation" method:"post" tags:"库位管理" summary:"创建库位" dc:"创建新的库位"`
WarehouseId string `json:"warehouseId" v:"required" dc:"仓库ID"`
ZoneId string `json:"zoneId" v:"required" dc:"库区ID"`
LocationCode string `json:"locationCode" v:"required|max-length:50#库位编码不能为空|库位编码不能超过50个字符" dc:"库位编码"`
LocationName string `json:"locationName" v:"required|max-length:100#库位名称不能为空|库位名称不能超过100个字符" dc:"库位名称"`
LocationType stock.LocationType `json:"locationType" v:"required" dc:"库位类型"`
CapacityUnitType stock.CapacityUnitType `json:"capacityUnitType" v:"required" dc:"容量单位类型"`
CapacityUnit string `json:"capacityUnit" v:"required" dc:"容量单位(如箱、托盘)"`
MaxCapacity int `json:"maxCapacity" v:"required|min:1#最大容量不能为空|最大容量必须大于0" dc:"最大容量"`
Status *stock.LocationStatus `json:"status" dc:"库位状态(可选,默认空闲)"`
Remark string `json:"remark" dc:"备注"`
}
// CreateLocationRes 创建库位响应
type CreateLocationRes struct {
Id *bson.ObjectID `json:"id" dc:"库位ID"`
}
// UpdateLocationReq 更新库位请求
type UpdateLocationReq struct {
g.Meta `path:"/updateLocation" method:"put" tags:"库位管理" summary:"更新库位" dc:"更新库位信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库位ID"`
WarehouseId string `json:"warehouseId" dc:"仓库ID"`
ZoneId string `json:"zoneId" dc:"库区ID"`
LocationCode string `json:"locationCode" dc:"库位编码"`
LocationName string `json:"locationName" dc:"库位名称"`
LocationType *stock.LocationType `json:"locationType" dc:"库位类型"`
CapacityUnitType *stock.CapacityUnitType `json:"capacityUnitType" dc:"容量单位类型"`
CapacityUnit string `json:"capacityUnit" dc:"容量单位"`
MaxCapacity *int `json:"maxCapacity" dc:"最大容量"`
Status *stock.LocationStatus `json:"status" dc:"库位状态"`
Remark string `json:"remark" dc:"备注"`
}
// UpdateLocationRes 更新库位响应
type UpdateLocationRes struct {
Id *bson.ObjectID `json:"id" dc:"库位ID"`
}
// DeleteLocationReq 删除库位请求
type DeleteLocationReq struct {
g.Meta `path:"/deleteLocation" method:"delete" tags:"库位管理" summary:"删除库位" dc:"删除库位"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库位ID"`
}
// UpdateLocationStatusReq 更新库位状态请求
type UpdateLocationStatusReq struct {
g.Meta `path:"/updateLocationStatus" method:"put" tags:"库位管理" summary:"更新库位状态" dc:"单独更新库位状态(空闲/占用/锁定/维护)"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库位ID"`
Status stock.LocationStatus `json:"status" v:"required|in:idle,occupied,locked,maintenance#状态不能为空|状态值无效" dc:"库位状态"`
}
// DeleteLocationRes 删除库位响应
type DeleteLocationRes struct {
Id *bson.ObjectID `json:"id" dc:"库位ID"`
}
// GetLocationReq 获取库位详情请求
type GetLocationReq struct {
g.Meta `path:"/getLocation" method:"get" tags:"库位管理" summary:"获取库位详情" dc:"获取库位详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库位ID"`
}
// GetLocationRes 获取库位详情响应
type GetLocationRes struct {
Id *bson.ObjectID `json:"id" dc:"库位ID"`
WarehouseId *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
ZoneName string `json:"zoneName" dc:"库区名称"`
LocationCode string `json:"locationCode" dc:"库位编码"`
LocationName string `json:"locationName" dc:"库位名称"`
LocationType stock.LocationType `json:"locationType" dc:"库位类型"`
LocationTypeText string `json:"locationTypeText" dc:"库位类型文本"`
MaxCapacity int `json:"maxCapacity" dc:"最大容量"`
CurrentCapacity int `json:"currentCapacity" dc:"当前容量"`
UsageRate float64 `json:"usageRate" dc:"使用率"`
Status stock.LocationStatus `json:"status" dc:"库位状态"`
StatusText string `json:"statusText" dc:"状态文本"`
Remark string `json:"remark" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListLocationReq 获取库位列表请求
type ListLocationReq struct {
g.Meta `path:"/listLocations" 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列表批量查询"`
ZoneId string `json:"zoneId" dc:"库区ID单个兼容旧版"`
ZoneIds []string `json:"zoneIds" dc:"库区ID列表批量查询"`
LocationType *stock.LocationType `json:"locationType" dc:"库位类型"`
Status *stock.LocationStatus `json:"status" dc:"库位状态"`
Keyword string `json:"keyword" dc:"关键词搜索(编码/名称)"`
}
// ListLocationRes 获取库位列表响应
type ListLocationRes struct {
List []LocationListItem `json:"list" dc:"库位列表"`
Total int64 `json:"total" dc:"总数"`
}
// LocationListItem 库位列表项
type LocationListItem struct {
Id *bson.ObjectID `json:"id" dc:"库位ID"`
WarehouseId *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
ZoneName string `json:"zoneName" dc:"库区名称"`
LocationCode string `json:"locationCode" dc:"库位编码"`
LocationName string `json:"locationName" dc:"库位名称"`
LocationType stock.LocationType `json:"locationType" dc:"库位类型"`
LocationTypeText string `json:"locationTypeText" dc:"库位类型文本"`
MaxCapacity int `json:"maxCapacity" dc:"最大容量"`
CurrentCapacity int `json:"currentCapacity" dc:"当前容量"`
UsageRate float64 `json:"usageRate" dc:"使用率"`
Status stock.LocationStatus `json:"status" dc:"库位状态"`
StatusText string `json:"statusText" dc:"状态文本"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}