Dockerfile

This commit is contained in:
2026-03-18 10:18:03 +08:00
parent 5c5dbc7420
commit b65f3439f3
189 changed files with 19027 additions and 0 deletions

7
model/config/capacity.go Normal file
View File

@@ -0,0 +1,7 @@
package config
type Capacity struct {
CapacityUnit string `bson:"capacityUnit" json:"capacityUnit"` // 容量单位(具体单位值)
MaxCapacity int `bson:"maxCapacity" json:"maxCapacity"` // 最大容量
CurrentCapacity int `bson:"currentCapacity" json:"currentCapacity"` // 当前容量
}

View File

@@ -0,0 +1,9 @@
package config
import (
"assets/consts/asset"
)
type AssetConfigInterface interface {
GetType() consts.AssetType
}

12
model/config/physical.go Normal file
View File

@@ -0,0 +1,12 @@
package config
// PhysicalAssetConfig 实物资产配置
type PhysicalAssetConfig struct {
Shipping *ShippingConfig `json:"shipping,omitempty"` // 配送配置
}
// ShippingConfig 配送配置
type ShippingConfig struct {
DeliveryMethod string `json:"deliveryMethod"` // 配送方式express快递/self_pickup自提
//DeliveryTime int `bson:"deliveryTime" json:"deliveryTime"` // 配送时效(小时)
}

45
model/config/service.go Normal file
View File

@@ -0,0 +1,45 @@
package config
import (
"assets/consts/asset"
)
// ServiceAssetConfig 服务资产配置
type ServiceAssetConfig struct {
ServiceAssetType consts.ServiceAssetType `json:"serviceAssetType"`
ServiceAssetArrivalConfig *ServiceAssetArrivalConfig `json:"serviceAssetArrivalConfig"`
}
type ServiceAssetArrivalConfig struct {
Schedule *ScheduleConfig `json:"schedule,omitempty"` // 排期配置
Booking *BookingConfig `json:"booking,omitempty"` // 预订配置
}
// ScheduleConfig 排期配置
type ScheduleConfig struct {
TimeSlots []*TimeSlot `json:"timeSlots"` // 时间段定义
Exceptions []*ScheduleException `json:"exceptions,omitempty"` // 例外日期
}
// BookingConfig 预订配置
type BookingConfig struct {
MinAdvance int `json:"minAdvance,omitempty"` // 最小提前时间(分钟)
MinDuration int `json:"minDuration,omitempty"` // 最小预订时长(分钟)
CancelWindow int `json:"cancelWindow,omitempty"` // 取消窗口(分钟)
}
// TimeSlot 时间段
type TimeSlot struct {
DayOfWeek string `bson:"dayOfWeek" json:"dayOfWeek"` // 星期几1-7
StartTime string `bson:"startTime" json:"startTime"` // 开始时间 HH:mm
EndTime string `bson:"endTime" json:"endTime"` // 结束时间 HH:mm
Capacity int `bson:"capacity,omitempty" json:"capacity,omitempty"` // 容量限制
}
// ScheduleException 排期例外
type ScheduleException struct {
Date string `bson:"date" json:"date"` // 日期 YYYY-MM-DD
Status int `bson:"status" json:"status"` // 状态1可用0不可用
Reason string `bson:"reason,omitempty" json:"reason,omitempty"` // 原因
DayOfWeek string `bson:"dayOfWeek" json:"dayOfWeek"` // 星期几1-7
}

19
model/config/virtual.go Normal file
View File

@@ -0,0 +1,19 @@
package config
// VirtualAssetConfig 虚拟资产配置
type VirtualAssetConfig struct {
VirtualAssetType string `json:"virtualType"`
CollectionPrice int `json:"collectionPrice"` // 合集价格(分为单位)
Currency string `json:"currency"` // 货币单位默认CNY
ApiConfig *ApiConfig `json:"apiConfig"`
}
// ApiConfig API配置虚拟资产专用
type ApiConfig struct {
Method string `json:"method"` // HTTP方法GET/POST/PUT/DELETE
RequestURL string `json:"requestURL"` // 请求地址
Headers map[string]string `json:"headers"` // 请求头配置
Params map[string]string `json:"params"` // 请求参数配置
AuthType string `json:"authType"` // 认证类型none/apikey/bearer/oauth
AuthConfig string `json:"authConfig"` // 认证配置
}

View File

@@ -0,0 +1,149 @@
package dto
import (
consts "assets/consts/asset"
"assets/consts/stock"
"assets/model/config"
enumDto "assets/model/dto/enum"
entity "assets/model/entity/asset"
"time"
"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"
)
// CreateAssetReq 创建资产请求
type CreateAssetReq struct {
g.Meta `path:"/createAsset" method:"post" tags:"资产管理" summary:"创建资产" dc:"创建新的资产"`
// 基础信息
Name string `json:"name" v:"required" dc:"资产名称"`
Description string `json:"description" dc:"资产描述"`
Type consts.AssetType `json:"type" v:"required" dc:"资产类型physical实物/virtual虚拟/service服务"`
CategoryId uint64 `json:"categoryId" v:"required" dc:"分类ID"`
CategoryPath string `json:"categoryPath" dc:"分类路径"`
ImageURL string `json:"imageUrl" dc:"主图URL"`
Images []string `json:"images" dc:"图片列表"`
Status *consts.AssetStatus `json:"status" dc:"状态1/0" d:"1"`
UnlimitedStock bool `json:"unlimitedStock" dc:"是否无库存限制"`
StockMode stock.StockMode `json:"stockMode" dc:"库存管理模式1-明细模式 2-批次模式" d:"2"`
// 上线和下线时间配置(由定时任务处理资产状态)
OnlineTime *time.Time `json:"onlineTime,omitempty" dc:"上线时间格式2006-01-02 15:04:05"`
OfflineTime *time.Time `json:"offlineTime,omitempty" dc:"下线时间格式2006-01-02 15:04:05"`
// 类型专用配置 - 实物资产配置
PhysicalAssetConfig *config.PhysicalAssetConfig `json:"physicalAssetConfig"`
// 类型专用配置 - 服务资产配置
ServiceAssetConfig *config.ServiceAssetConfig `json:"serviceAssetConfig"`
// 类型专用配置 - 虚拟资产配置
VirtualAssetConfig *config.VirtualAssetConfig `json:"virtualAssetConfig"`
// 扩展字段
Metadata []map[string]interface{} `json:"metadata" dc:"动态元数据"`
TenantModuleType beans.TenantModuleType `json:"tenantModuleType" dc:"租户模块类型"`
}
// CreateAssetRes 创建资产响应
type CreateAssetRes struct {
Id uint64 `json:"id" dc:"资产ID"`
}
// ListAssetReq 获取资产列表请求
type ListAssetReq struct {
g.Meta `path:"/listAssets" method:"get" tags:"资产管理" summary:"获取资产列表" dc:"分页查询资产列表,支持多条件筛选"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
Name string `json:"name" dc:"资产名称"`
Type consts.AssetType `json:"type" dc:"资产类型"`
CategoryId string `json:"categoryId" dc:"分类ID"`
CategoryPath string `json:"categoryPath" dc:"分类路径"`
Status *consts.AssetStatus `json:"status" dc:"状态"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
// ListAssetRes 获取资产列表响应
type ListAssetRes struct {
List []AssetListItem `json:"list" dc:"资产列表"`
Total int `json:"total" dc:"总数"`
}
type AssetListItem struct {
// 基础信息
Id uint64 `json:"id"` // 资产ID
Name string `json:"name"` // 资产名称
Type consts.AssetType `json:"type"` // 资产类型physical实物/virtual虚拟/service服务
TypeName string `json:"typeName"` // 资产类型physical实物/virtual虚拟/service服务
CategoryId uint64 `json:"categoryId"` // 分类ID
UnlimitedStock bool `json:"unlimitedStock"` // 是否无库存限制
Status *consts.AssetStatus `json:"status"` // 资产状态active启用/inactive停用
BasePrice int `json:"basePrice"` // 基础价格(分为单位)
OnlineTime *gtime.Time `json:"onlineTime,omitempty"` // 上线时间
OfflineTime *gtime.Time `json:"offlineTime,omitempty"` // 下线时间
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// GetAssetReq 获取资产详情请求
type GetAssetReq struct {
g.Meta `path:"/getAsset" method:"get" tags:"资产管理" summary:"获取资产详情" dc:"获取资产详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"资产ID"`
}
// GetAssetRes 获取资产详情响应
type GetAssetRes struct {
*entity.Asset
CategoryName string `json:"categoryName" dc:"分类名称"`
ImgAddressPrefix string `json:"imgAddressPrefix"`
}
// GetAssetAndSkuReq 获取资产和Sku详情请求
type GetAssetAndSkuReq struct {
g.Meta `path:"/getAssetAndSku" method:"get" tags:"资产管理" summary:"获取资产和SKU详情" dc:"获取资产和SKU详情"`
AssetId *bson.ObjectID `json:"assetId" v:"required" dc:"资产ID"`
}
// GetAssetAndSkuRes 获取资产详情响应
type GetAssetAndSkuRes struct {
*entity.Asset
Skus []entity.AssetSku `json:"skus" dc:"SKU列表"`
TenantModuleType []enumDto.KeyValue `json:"tenantModuleType" dc:"租户模块类型"`
ImgAddressPrefix string `json:"imgAddressPrefix"`
}
// UpdateAssetReq 更新资产请求
type UpdateAssetReq struct {
g.Meta `path:"/updateAsset" method:"put" tags:"资产管理" summary:"更新资产" dc:"更新资产信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"资产ID"`
// 基础信息
Name string `json:"name" dc:"资产名称"`
Description string `json:"description" dc:"资产描述"`
Type consts.AssetType `json:"type" dc:"资产类型physical实物/virtual虚拟/service服务"`
CategoryId *bson.ObjectID `json:"categoryId" dc:"分类ID"`
ImageURL string `json:"imageUrl" dc:"主图URL"`
Images []string `json:"images" dc:"图片列表"`
Status *consts.AssetStatus `json:"status,omitempty" dc:"状态1/0"`
// 上线和下线时间配置(由定时任务处理资产状态)
OnlineTime *time.Time `json:"onlineTime,omitempty" dc:"上线时间格式2006-01-02 15:04:05"`
OfflineTime *time.Time `json:"offlineTime,omitempty" dc:"下线时间格式2006-01-02 15:04:05"`
// 类型专用配置 - 实物资产配置
PhysicalAssetConfig *config.PhysicalAssetConfig `json:"physicalAssetConfig"`
// 类型专用配置 - 服务资产配置
ServiceAssetConfig *config.ServiceAssetConfig `json:"serviceAssetConfig"`
// 类型专用配置 - 虚拟资产配置
VirtualAssetConfig *config.VirtualAssetConfig `json:"virtualAssetConfig"`
// 扩展字段
Metadata []map[string]interface{} `json:"metadata" dc:"动态元数据"`
}
// UpdateAssetStatusReq 更新资产状态请求
type UpdateAssetStatusReq struct {
g.Meta `path:"/updateAssetStatus" method:"put" tags:"资产管理" summary:"更新资产状态" dc:"更新资产状态"`
Id *bson.ObjectID `json:"id" v:"required" dc:"资产ID"`
Status *consts.AssetStatus `json:"status" v:"required|in:1,0" dc:"状态1启用/0停用"`
}
// DeleteAssetReq 删除资产请求
type DeleteAssetReq struct {
g.Meta `path:"/deleteAsset" method:"delete" tags:"资产管理" summary:"删除资产" dc:"删除资产"`
Id *bson.ObjectID `json:"id" v:"required" dc:"资产ID"`
}

View File

@@ -0,0 +1,122 @@
package dto
import (
consts "assets/consts/asset"
"assets/consts/stock"
entity "assets/model/entity/asset"
"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"
)
// CreateAssetSkuReq 创建SKU请求
type CreateAssetSkuReq struct {
g.Meta `path:"/createAssetSku" method:"post" tags:"SKU管理" summary:"创建SKU" dc:"创建新的资产SKU"`
AssetId *bson.ObjectID `json:"assetId" v:"required" dc:"关联资产ID"`
AssetName string `json:"assetName" v:"required" dc:"关联资产名称"`
SkuName string `json:"skuName" v:"required" dc:"SKU名称"`
SpecsCount int `json:"specsCount" v:"required|min:1" dc:"规格数量"`
SpecsUnit *entity.SpecsUnitKeyValue `json:"specsUnit" v:"required" dc:"规格单位"`
SpecValues []map[string]interface{} `json:"specValues" dc:"规格值"`
ImageURL string `json:"imageUrl" v:"required" dc:"SKU主图"`
Price int `json:"price" v:"required|min:0" dc:"价格(分为单位)"`
Sort int `json:"sort" v:"required|min:0" dc:"排序"`
Status *consts.AssetSkuStatus `json:"status" v:"required|in:1,0" dc:"状态"`
UnlimitedStock bool `json:"unlimitedStock" v:"required" dc:"是否无库存限制"`
StockMode stock.StockMode `json:"stockMode" dc:"库存管理模式:1-明细模式 2-批次模式"`
CategoryId *bson.ObjectID `json:"categoryId" dc:"分类ID"`
CategoryPath string `json:"categoryPath" dc:"分类路径"`
TenantModuleType beans.TenantModuleType `json:"tenantModuleType" dc:"租户模块类型"`
}
// CreateAssetSkuRes 创建SKU响应
type CreateAssetSkuRes struct {
Id *bson.ObjectID `json:"id" dc:"SKU ID"`
}
// UpdateAssetSkuReq 更新SKU请求
type UpdateAssetSkuReq struct {
g.Meta `path:"/updateAssetSku" method:"put" tags:"SKU管理" summary:"更新SKU" dc:"更新SKU信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
SkuName string `json:"skuName" dc:"SKU名称"`
SpecsCount int `json:"specsCount" dc:"规格数量"`
SpecsUnit *entity.SpecsUnitKeyValue `json:"specsUnit" dc:"规格单位"`
SpecValues []map[string]interface{} `json:"specValues" dc:"规格值"`
ImageURL string `json:"imageUrl" dc:"SKU主图"`
Price int `json:"price" dc:"价格(分为单位)"`
Sort int `json:"sort" dc:"排序"`
Stock int `json:"stock" dc:"库存数量"`
Status *consts.AssetSkuStatus `json:"status" dc:"状态"`
}
// DeleteAssetSkuReq 删除SKU请求
type DeleteAssetSkuReq struct {
g.Meta `path:"/deleteAssetSku" method:"delete" tags:"SKU管理" summary:"删除SKU" dc:"删除SKU"`
Id *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
}
// GetAssetSkuModuleReq 获取SKU详情请求
type GetAssetSkuModuleReq struct {
g.Meta `path:"/getAssetSkuModule" method:"get" tags:"SKU管理" summary:"获取SKU模块详情" dc:"获取SKU模块详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
}
// GetAssetSkuModuleRes 获取SKU详情响应
type GetAssetSkuModuleRes struct {
AssetId *bson.ObjectID `json:"assetId"`
ExpireAt *gtime.Time `json:"expireAt"`
}
// GetAssetSkuReq 获取SKU详情请求
type GetAssetSkuReq struct {
g.Meta `path:"/getAssetSku" method:"get" tags:"SKU管理" summary:"获取SKU详情" dc:"获取SKU详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
}
// GetAssetSkuRes 获取SKU详情响应
type GetAssetSkuRes struct {
*entity.AssetSku
ImgAddressPrefix string `json:"imgAddressPrefix"`
}
// ListAssetSkuReq 获取SKU列表请求
type ListAssetSkuReq struct {
g.Meta `path:"/listAssetSkus" method:"get" tags:"SKU管理" summary:"获取SKU列表" dc:"分页查询SKU列表支持多条件筛选"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
Id *bson.ObjectID `json:"id" dc:"SKU ID"`
AssetId *bson.ObjectID `json:"assetId" v:"required" dc:"资产ID"`
Status *consts.AssetSkuStatus `json:"status" dc:"状态"`
Keyword string `json:"keyword" dc:"关键词搜索"`
MinPrice int `json:"minPrice" dc:"最低价格"`
MaxPrice int `json:"maxPrice" dc:"最高价格"`
CategoryPath string `json:"categoryPath" dc:"分类路径"`
}
// ListAssetSkuRes 获取SKU列表响应
type ListAssetSkuRes struct {
List []*AssetSkuListResItem `json:"list" dc:"SKU列表"`
Total int64 `json:"total" dc:"总数"`
}
type AssetSkuListResItem struct {
Id *bson.ObjectID `json:"id"` // SKU ID
AssetId *bson.ObjectID `json:"assetId"`
AssetName string `json:"assetName"` // 资产名称
SkuName string `json:"skuName"` // SKU名称
SpecsCount int `json:"specsCount"` // 规格数量
SpecsUnit *entity.SpecsUnitKeyValue `json:"specsUnit"` // 规格单位
SpecValues []map[string]interface{} `json:"specValues"` // 规格值:{"颜色":"红色","尺寸":"L","时长":"1个月","平台":"抖音"}
Price int `json:"price"` // 价格(分为单位)
UnlimitedStock bool `json:"unlimitedStock"` // 是否无库存限制
Stock int `json:"stock"` // 库存数量
Sort int `json:"sort"` // 排序
Status *consts.AssetSkuStatus `json:"status"` // 状态active/inactive/disabled
StockMode stock.StockMode `json:"stockMode"` // 库存管理模式1-明细模式 2-批次模式
CreatedAt *gtime.Time `json:"createdAt"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt"` // 更新时间
}

View File

@@ -0,0 +1,124 @@
package dto
import (
consts "assets/consts/category"
entity "assets/model/entity/asset"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// CreateCategoryReq 创建分类请求
type CreateCategoryReq struct {
g.Meta `path:"/createCategory" method:"post" tags:"分类管理" summary:"创建分类" dc:"创建新的分类"`
Name string `json:"name" v:"required" dc:"分类名称"`
ParentId string `json:"parentId" dc:"父分类ID"`
Image string `json:"image" dc:"分类图片"`
Sort int `json:"sort" dc:"排序"`
Path string `json:"path" dc:"分类路径"`
Level int `json:"level" dc:"分类层级"`
Status consts.CategoryStatusType `json:"status" v:"in:1,0" default:"1" dc:"状态1启用0禁用"`
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
}
// CreateCategoryRes 创建分类响应
type CreateCategoryRes struct {
Bid string `json:"bid" dc:"分类ID"`
}
// UpdateCategoryReq 更新分类请求
type UpdateCategoryReq struct {
g.Meta `path:"/updateCategory" method:"put" tags:"分类管理" summary:"更新分类" dc:"更新分类信息"`
Id uint64 `json:"id" v:"required-without:Bid|integer#Id不能为空|Id必须是整数" dc:"分类ID"`
Bid string `json:"bid" v:"required-without:Id|string#Bid不能为空|Bid必须是字符串" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ParentId string `json:"parentId" dc:"父分类ID"`
Image string `json:"image" dc:"分类图片"`
Sort int `json:"sort" dc:"排序"`
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
Status consts.CategoryStatusType `json:"status" dc:"状态1启用0禁用"`
}
// UpdateCategoryStatusReq 更新分类状态请求
type UpdateCategoryStatusReq struct {
g.Meta `path:"/updateCategoryStatus" method:"put" tags:"分类管理" summary:"更新分类状态" dc:"更新分类状态"`
Id string `json:"id" v:"required" dc:"分类ID"`
Status consts.CategoryStatusType `json:"status" v:"in:1,0" dc:"状态1启用0禁用"`
}
// DeleteCategoryReq 删除分类请求
type DeleteCategoryReq struct {
g.Meta `path:"/deleteCategory" method:"delete" tags:"分类管理" summary:"删除分类" dc:"删除分类"`
Bid string `json:"bid" v:"required" dc:"分类ID"`
}
// GetCategoryTreeReq 获取分类树请求
type GetCategoryTreeReq struct {
g.Meta `path:"/getCategoryTree" method:"get" tags:"分类管理" summary:"获取分类树" dc:"获取分类树"`
Name string `json:"name" dc:"名称"`
}
// GetCategoryTreeRes 获取分类树响应
type GetCategoryTreeRes struct {
Tree []*CategoryTreeNode `json:"tree" dc:"分类树"`
}
// CategoryTreeNode 分类树节点
type CategoryTreeNode struct {
Id uint64 `json:"id" dc:"分类ID"`
Bid string `json:"bid" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
Level int `json:"level" dc:"分类层级"`
Type string `json:"type" dc:"分类类型"`
Path string `json:"path" dc:"分类路径"`
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
Status consts.CategoryStatusType `json:"status" dc:"状态"`
Sort int `json:"sort" dc:"排序"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
Children []*CategoryTreeNode `json:"children" dc:"子分类"`
}
// ListCategoryReq 获取分类列表请求
type ListCategoryReq struct {
g.Meta `path:"/listCategories" method:"get" tags:"分类管理" summary:"获取分类列表" dc:"获取分类列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
ParentId string `json:"parentId" dc:"父分类ID"`
Status consts.CategoryStatusType `json:"status" dc:"状态1启用0禁用"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
// ListCategoryRes 获取分类列表响应
type ListCategoryRes struct {
List []GetCategoryRes `json:"list" dc:"分类列表"`
Total int `json:"total" dc:"总数"`
}
// GetCategoryReq 获取分类详情请求
type GetCategoryReq struct {
g.Meta `path:"/getCategory" method:"get" tags:"分类管理" summary:"获取分类详情" dc:"获取分类详情"`
Id uint64 `json:"id" v:"required-without:Bid|integer#Id不能为空|Id必须是整数" dc:"分类ID"`
Bid string `json:"bid" v:"required-without:Id|string#Bid不能为空|Bid必须是字符串" dc:"分类ID"`
}
// GetCategoryRes 获取分类详情响应
type GetCategoryRes struct {
Id uint64 `json:"id" dc:"分类ID"`
Bid string `json:"bid" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ParentId string `json:"parentId" dc:"父分类ID"`
Path string `json:"path" dc:"分类路径"`
Level int `json:"level" dc:"分类层级"`
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
Sort int `json:"sort" dc:"排序"`
Image string `json:"image" dc:"分类图片"`
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
Status consts.CategoryStatusType `json:"status" dc:"状态1启用0禁用"`
Creator string `json:"creator" dc:"创建人"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
Updater string `json:"updater" dc:"更新人"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}

View File

@@ -0,0 +1,137 @@
package dto
import (
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// GeneratePrivateCategoryTestDataReq 生成私域分类测试数据请求
type GeneratePrivateCategoryTestDataReq struct {
g.Meta `path:"/generateTestData" method:"post" tags:"私域分类管理" summary:"生成测试数据" dc:"生成私域分类测试数据"`
}
// CreatePrivateCategoryReq 创建私域分类请求
type CreatePrivateCategoryReq struct {
g.Meta `path:"/createPrivateCategory" method:"post" tags:"私域分类管理" summary:"创建私域分类" dc:"创建新的私域分类"`
Name string `json:"name" v:"required" dc:"分类名称"`
ParentID *bson.ObjectID `json:"parentId" dc:"父分类ID为空表示根分类"`
Path string `json:"path" dc:"分类路径,如:/root/parent"`
Level int `json:"level" dc:"分类层级"`
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
Sort int `json:"sort" dc:"排序"`
Image string `json:"image" dc:"分类图片"`
}
// CreatePrivateCategoryRes 创建私域分类响应
type CreatePrivateCategoryRes struct {
ID *bson.ObjectID `json:"id"` // 分类ID
}
// BatchCreatePrivateCategoryReq 批量创建私域分类请求
type BatchCreatePrivateCategoryReq struct {
g.Meta `path:"/batchCreatePrivateCategory" method:"post" tags:"私域分类管理" summary:"批量创建私域分类" dc:"批量创建私域分类"`
Categories []CreatePrivateCategoryReq `json:"categories" v:"required" dc:"分类列表"`
}
// BatchCreatePrivateCategoryRes 批量创建私域分类响应
type BatchCreatePrivateCategoryRes struct {
IDs []*bson.ObjectID `json:"ids"` // 创建的ID列表
}
// UpdatePrivateCategoryReq 更新私域分类请求
type UpdatePrivateCategoryReq struct {
g.Meta `path:"/updatePrivateCategory" method:"put" tags:"私域分类管理" summary:"更新私域分类" dc:"更新私域分类信息"`
ID *bson.ObjectID `json:"id" v:"required" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ParentID string `json:"parentId" dc:"父分类ID"`
Path string `json:"path" dc:"分类路径"`
Level int `json:"level" dc:"分类层级"`
IsLeafNode *bool `json:"isLeafNode" dc:"是否叶子节点"`
Sort int `json:"sort" dc:"排序"`
Image string `json:"image" dc:"分类图片"`
}
// DeletePrivateCategoryReq 删除私域分类请求
type DeletePrivateCategoryReq struct {
g.Meta `path:"/deletePrivateCategory" method:"delete" tags:"私域分类管理" summary:"删除私域分类" dc:"删除私域分类"`
ID *bson.ObjectID `json:"id" v:"required" dc:"分类ID"`
}
// GetPrivateCategoryReq 获取私域分类详情请求
type GetPrivateCategoryReq struct {
g.Meta `path:"/getPrivateCategory" method:"get" tags:"私域分类管理" summary:"获取私域分类详情" dc:"获取私域分类详情"`
ID *bson.ObjectID `json:"id" v:"required" dc:"分类ID"`
}
// GetPrivateCategoryRes 获取私域分类详情响应
type GetPrivateCategoryRes struct {
ID *bson.ObjectID `json:"id"`
Name string `json:"name"`
ParentID string `json:"parentId"`
Path string `json:"path"`
Level int `json:"level"`
IsLeafNode bool `json:"isLeafNode"`
Sort int `json:"sort"`
Image string `json:"image"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// ListPrivateCategoryReq 获取私域分类列表请求
type ListPrivateCategoryReq struct {
g.Meta `path:"/listPrivateCategory" method:"get" tags:"私域分类管理" summary:"获取私域分类列表" dc:"分页查询私域分类列表"`
Name string `json:"name" dc:"分类名称(模糊查询)"`
ParentID string `json:"parentId" dc:"父分类ID"`
Level int `json:"level" dc:"分类层级"`
IsLeafNode *bool `json:"isLeafNode" dc:"是否叶子节点"`
PageNum int `json:"pageNum" dc:"页码"`
PageSize int `json:"pageSize" dc:"每页大小"`
}
// ListPrivateCategoryRes 获取私域分类列表响应
type ListPrivateCategoryRes struct {
List []*PrivateCategoryListItem `json:"list" dc:"分类列表"`
Total int64 `json:"total" dc:"总数"`
}
// PrivateCategoryListItem 私域分类列表项
type PrivateCategoryListItem struct {
ID *bson.ObjectID `json:"id"`
Name string `json:"name"`
ParentID string `json:"parentId"`
Path string `json:"path"`
Level int `json:"level"`
IsLeafNode bool `json:"isLeafNode"`
Sort int `json:"sort"`
Image string `json:"image"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// GetPrivateCategoryTreeReq 获取私域分类树请求
type GetPrivateCategoryTreeReq struct {
g.Meta `path:"/getPrivateCategoryTree" method:"get" tags:"私域分类管理" summary:"获取私域分类树" dc:"获取私域分类树"`
}
// GetPrivateCategoryTreeRes 获取私域分类树响应
type GetPrivateCategoryTreeRes struct {
Tree []*PrivateCategoryTreeItem `json:"tree" dc:"分类树"`
}
// PrivateCategoryTreeItem 私域分类树项
type PrivateCategoryTreeItem struct {
ID *bson.ObjectID `json:"id"`
Name string `json:"name"`
ParentID string `json:"parentId"`
Path string `json:"path"`
Level int `json:"level"`
IsLeafNode bool `json:"isLeafNode"`
Sort int `json:"sort"`
Image string `json:"image"`
}

View File

@@ -0,0 +1,124 @@
package dto
import (
"assets/consts/stock"
"assets/model/config"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// GeneratePrivateSkuTestDataReq 生成私域SKU测试数据请求
type GeneratePrivateSkuTestDataReq struct {
g.Meta `path:"/generateTestData" method:"post" tags:"私域SKU管理" summary:"生成测试数据" dc:"生成私域SKU测试数据"`
}
// CreatePrivateSkuReq 创建私域SKU请求
type CreatePrivateSkuReq struct {
g.Meta `path:"/createPrivateSku" method:"post" tags:"私域SKU管理" summary:"创建私域SKU" dc:"创建新的私域SKU"`
SkuName string `json:"skuName" v:"required" dc:"SKU名称"`
ImageURL string `json:"imageUrl" dc:"SKU主图"`
Price int `json:"price" v:"required|min:0" dc:"价格(分为单位)"`
Stock int `json:"stock" v:"min:0" dc:"库存数量"`
Sort int `json:"sort" dc:"排序"`
CapacityUnitType stock.CapacityUnitType `json:"capacityUnitType" v:"required" dc:"容量单位类型"`
Capacity config.Capacity `json:"capacity" v:"required" dc:"容量信息"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"私域分类路径"`
}
// CreatePrivateSkuRes 创建私域SKU响应
type CreatePrivateSkuRes struct {
ID *bson.ObjectID `json:"id"` // SKU ID
}
// BatchCreatePrivateSkuReq 批量创建私域SKU请求
type BatchCreatePrivateSkuReq struct {
g.Meta `path:"/batchCreatePrivateSku" method:"post" tags:"私域SKU管理" summary:"批量创建私域SKU" dc:"批量创建私域SKU"`
Skus []CreatePrivateSkuReq `json:"skus" v:"required" dc:"SKU列表"`
}
// BatchCreatePrivateSkuRes 批量创建私域SKU响应
type BatchCreatePrivateSkuRes struct {
IDs []*bson.ObjectID `json:"ids"` // 创建的ID列表
}
// UpdatePrivateSkuReq 更新私域SKU请求
type UpdatePrivateSkuReq struct {
g.Meta `path:"/updatePrivateSku" method:"put" tags:"私域SKU管理" summary:"更新私域SKU" dc:"更新私域SKU信息"`
ID *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
SkuName string `json:"skuName" dc:"SKU名称"`
ImageURL string `json:"imageUrl" dc:"SKU主图"`
Price int `json:"price" v:"min:0" dc:"价格(分为单位)"`
Stock int `json:"stock" v:"min:0" dc:"库存数量"`
Sort int `json:"sort" dc:"排序"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"私域分类路径"`
}
// DeletePrivateSkuReq 删除私域SKU请求
type DeletePrivateSkuReq struct {
g.Meta `path:"/deletePrivateSku" method:"delete" tags:"私域SKU管理" summary:"删除私域SKU" dc:"删除私域SKU"`
ID *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
}
// GetPrivateSkuReq 获取私域SKU详情请求
type GetPrivateSkuReq struct {
g.Meta `path:"/getPrivateSku" method:"get" tags:"私域SKU管理" summary:"获取私域SKU详情" dc:"获取私域SKU详情"`
ID *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
}
// GetPrivateSkuRes 获取私域SKU详情响应
type GetPrivateSkuRes struct {
ID *bson.ObjectID `json:"id"`
SkuName string `json:"skuName"`
ImageURL string `json:"imageUrl"`
Price int `json:"price"`
Stock int `json:"stock"`
Sort int `json:"sort"`
PrivateCategoryPath string `json:"privateCategoryPath"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// ListPrivateSkuReq 获取私域SKU列表请求
type ListPrivateSkuReq struct {
g.Meta `path:"/listPrivateSku" method:"get" tags:"私域SKU管理" summary:"获取私域SKU列表" dc:"分页查询私域SKU列表"`
SkuName string `json:"skuName" dc:"SKU名称模糊查询"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"分类路径"`
MinPrice int `json:"minPrice" dc:"最低价格"`
MaxPrice int `json:"maxPrice" dc:"最高价格"`
PageNum int `json:"pageNum" dc:"页码"`
PageSize int `json:"pageSize" dc:"每页大小"`
}
// ListPrivateSkuRes 获取私域SKU列表响应
type ListPrivateSkuRes struct {
List []*PrivateSkuListItem `json:"list" dc:"SKU列表"`
Total int64 `json:"total" dc:"总数"`
}
// PrivateSkuListItem 私域SKU列表项
type PrivateSkuListItem struct {
ID *bson.ObjectID `json:"id"`
SkuName string `json:"skuName"`
ImageURL string `json:"imageUrl"`
Price int `json:"price"`
Stock int `json:"stock"`
Sort int `json:"sort"`
PrivateCategoryPath string `json:"privateCategoryPath"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// UpdatePrivateSkuStockReq 更新私域SKU库存请求
type UpdatePrivateSkuStockReq struct {
g.Meta `path:"/updatePrivateSkuStock" method:"put" tags:"私域SKU管理" summary:"更新私域SKU库存" dc:"更新私域SKU库存"`
ID *bson.ObjectID `json:"id" v:"required" dc:"SKU ID"`
StockChange int `json:"stockChange" v:"required" dc:"库存变化量(正数增加,负数减少)"`
}

View File

@@ -0,0 +1,73 @@
package dto
import (
"assets/consts/asset"
"github.com/gogf/gf/v2/frame/g"
)
// GetAssetTypeReq 获取资产类型请求
type GetAssetTypeReq struct {
g.Meta `path:"/getAssetType" method:"get" tags:"资产管理" summary:"获取资产类型选项" dc:"获取所有资产类型的选项列表"`
}
// GetAssetTypeRes 获取资产类型响应
type GetAssetTypeRes struct {
Options []KeyValue `json:"options" dc:"资产类型选项列表"`
}
// GetCategoryAttrTypeReq 获取分类属性类型请求
type GetCategoryAttrTypeReq struct {
g.Meta `path:"/getCategoryAttrType" method:"get" tags:"枚举管理" summary:"获取分类属性类型" dc:"获取分类属性类型"`
}
// GetCategoryAttrTypeRes 获取分类属性类型响应
type GetCategoryAttrTypeRes struct {
Options []KeyValue `json:"options" dc:"分类属性类型选项列表"`
}
// GetSpecsUnitReq 获取规格单位
type GetSpecsUnitReq struct {
g.Meta `path:"/getSpecsUnit" method:"get" tags:"枚举管理" summary:"获取规格单位" dc:"获取规格单位"`
AssetType *consts.AssetType `json:"assetType" v:"required|in:physical,virtual,service" dc:"资产类型"`
}
// GetSpecsUnitRes 获取规格单位响应
type GetSpecsUnitRes struct {
Options []KeyValue `json:"options" dc:"规格单位选项列表"`
}
// GetTenantModuleTypeReq 获取租户模块类型请求
type GetTenantModuleTypeReq struct {
g.Meta `path:"/getTenantModuleType" method:"get" tags:"枚举管理" summary:"获取租户模块类型" dc:"获取租户模块类型"`
AssetId string `json:"assetId" v:"required|in:physical,virtual,service" dc:"资产id"`
}
// GetTenantModuleTypeRes 获取租户模块类型响应
type GetTenantModuleTypeRes struct {
Options []KeyValue `json:"options" dc:"租户模块类型列表"`
}
type KeyValue struct {
Key interface{} `json:"key"` // 对应原有常量值
Value interface{} `json:"value"` // 对应描述信息
}
type GetDictRes struct {
g.Meta `mime:"application/json"`
Info *DictTypeRes `json:"info"`
Values []*DictDataRes `json:"values"`
}
type DictTypeRes struct {
DictName string `json:"name"`
DictType string `json:"type"`
Remark string `json:"remark"`
}
type DictDataRes struct {
DictValue string `json:"key"`
DictLabel string `json:"value"`
DictType string `json:"type"`
IsDefault int `json:"isDefault"`
Remark string `json:"remark"`
}

View File

@@ -0,0 +1,96 @@
package dto
import (
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// CreatePurchaseInboundReq 创建采购入库请求
type CreatePurchaseInboundReq struct {
g.Meta `path:"/createPurchaseInbound" method:"post" tags:"采购入库管理" summary:"创建采购入库" dc:"将采购订单明细入库到私域库存"`
OrderItemId *bson.ObjectID `json:"orderItemId" v:"required" dc:"采购订单明细ID"`
InboundQty int `json:"inboundQty" v:"required|min:1" dc:"入库数量"`
// 仓储信息(非必填)
WarehouseId *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
LocationId *bson.ObjectID `json:"locationId" dc:"库位ID"`
// 私域SKU和分类必填
PrivateSkuId *bson.ObjectID `json:"privateSkuId" v:"required" dc:"私域SKU ID"`
PrivateCategoryId *bson.ObjectID `json:"privateCategoryId" v:"required" dc:"私域分类ID"`
Remark string `json:"remark" dc:"入库备注"`
}
// CreatePurchaseInboundRes 创建采购入库响应
type CreatePurchaseInboundRes struct {
Id *bson.ObjectID `json:"id" dc:"入库记录ID"`
InboundNo string `json:"inboundNo" dc:"入库单号"`
BatchNo string `json:"batchNo" dc:"批次号"`
}
// GetPurchaseInboundReq 获取入库详情请求
type GetPurchaseInboundReq struct {
g.Meta `path:"/getPurchaseInbound" method:"get" tags:"采购入库管理" summary:"获取入库详情" dc:"根据ID获取入库记录详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"入库记录ID"`
}
// GetPurchaseInboundRes 获取入库详情响应
type GetPurchaseInboundRes struct {
Id *bson.ObjectID `json:"id" dc:"入库记录ID"`
InboundNo string `json:"inboundNo" dc:"入库单号"`
BatchNo string `json:"batchNo" dc:"批次号"`
// 关联信息
OrderId *bson.ObjectID `json:"orderId" dc:"采购订单ID"`
OrderItemId *bson.ObjectID `json:"orderItemId" dc:"采购订单明细ID"`
// 入库数量和时间
InboundQty int `json:"inboundQty" dc:"本次入库数量"`
InboundDate string `json:"inboundDate" dc:"入库日期"`
// 仓储信息
WarehouseId *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
ZoneName string `json:"zoneName" dc:"库区名称"`
LocationId *bson.ObjectID `json:"locationId" dc:"库位ID"`
LocationName string `json:"locationName" dc:"库位名称"`
// 私域SKU和分类
PrivateSkuId *bson.ObjectID `json:"privateSkuId" dc:"私域SKU ID"`
PrivateSkuName string `json:"privateSkuName" dc:"私域SKU名称"`
PrivateCategoryId *bson.ObjectID `json:"privateCategoryId" dc:"私域分类ID"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"私域分类路径"`
// 生成的库存信息
PrivateStockId *bson.ObjectID `json:"privateStockId" dc:"关联的私域库存ID"`
Remark string `json:"remark" dc:"入库备注"`
CreatedAt string `json:"createdAt" dc:"创建时间"`
UpdatedAt string `json:"updatedAt" dc:"更新时间"`
}
// ListPurchaseInboundReq 获取入库列表请求
type ListPurchaseInboundReq struct {
g.Meta `path:"/listPurchaseInbounds" method:"get" tags:"采购入库管理" summary:"获取入库列表" dc:"分页查询入库记录列表"`
OrderId *bson.ObjectID `json:"orderId" dc:"采购订单ID"`
OrderItemId *bson.ObjectID `json:"orderItemId" dc:"采购订单明细ID"`
InboundNo string `json:"inboundNo" dc:"入库单号"`
StartDate string `json:"startDate" dc:"开始日期(YYYY-MM-DD)"`
EndDate string `json:"endDate" dc:"结束日期(YYYY-MM-DD)"`
beans.Page `json:",inline"`
beans.OrderBy `json:",inline"`
}
// ListPurchaseInboundRes 获取入库列表响应
type ListPurchaseInboundRes struct {
Total int64 `json:"total" dc:"总数"`
List []*GetPurchaseInboundRes `json:"list" dc:"列表"`
}

View File

@@ -0,0 +1,232 @@
package dto
import (
"assets/consts/procurement"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// GeneratePurchaseOrderTestDataReq 生成采购订单测试数据请求
type GeneratePurchaseOrderTestDataReq struct {
g.Meta `path:"/generateTestData" method:"post" tags:"采购订单管理" summary:"生成测试数据" dc:"生成采购订单测试数据"`
}
// CreatePurchaseOrderReq 创建采购订单请求
type CreatePurchaseOrderReq struct {
g.Meta `path:"/createPurchaseOrder" method:"post" tags:"采购订单管理" summary:"创建采购订单" dc:"创建新的采购订单"`
// 基础订单信息
OrderNo string `json:"orderNo" v:"required" dc:"订单编号"`
Title string `json:"title" v:"required" dc:"订单标题"`
Description string `json:"description" dc:"订单描述"`
OrderType consts.PurchaseOrderType `json:"orderType" v:"required" dc:"订单类型direct/assignment/bidding"`
// 需求方信息
BuyerId *bson.ObjectID `json:"buyerId" v:"required" dc:"采购方ID经销商/门店)"`
BuyerName string `json:"buyerName" v:"required" dc:"采购方名称"`
BuyerType string `json:"buyerType" v:"required" dc:"采购方类型"`
// 通用状态信息
Priority int `json:"priority" dc:"优先级"`
// 通用字段
ExpectedDelivery *gtime.Time `json:"expectedDelivery" dc:"期望交付时间"`
ExpiryTime *gtime.Time `json:"expiryTime" dc:"订单有效期/竞价结束时间"`
// 模式特定信息
DirectPurchase *CreateDirectPurchaseReq `json:"directPurchase" dc:"指定供应商模式信息"`
BiddingInfo *CreateBiddingReq `json:"biddingInfo" dc:"竞价模式信息"`
}
// CreateDirectPurchaseReq 指定供应商模式信息
type CreateDirectPurchaseReq struct {
SupplierId *bson.ObjectID `json:"supplierId" v:"required" dc:"指定供应商ID"`
SupplierName string `json:"supplierName" dc:"指定供应商名称"`
SupplierCode string `json:"supplierCode" dc:"供应商编码"`
AssignReason string `json:"assignReason" dc:"指派原因"`
DeliveryAddress string `json:"deliveryAddress" dc:"交付地址"`
ContactPerson string `json:"contactPerson" dc:"联系人"`
ContactPhone string `json:"contactPhone" dc:"联系电话"`
}
// CreateBiddingReq 竞价模式信息
type CreateBiddingReq struct {
BidMode consts.BidMode `json:"bidMode" v:"required" dc:"竞价模式price/quality/time/mixed"`
MinSuppliers int `json:"minSuppliers" v:"min:1" dc:"最少参与供应商数"`
MaxSuppliers int `json:"maxSuppliers" v:"min:1" dc:"最多参与供应商数"`
BidDuration int `json:"bidDuration" v:"min:1" dc:"竞价持续时长(分钟)"`
BidStartAt *gtime.Time `json:"bidStartAt" dc:"竞价开始时间"`
BidEndAt *gtime.Time `json:"bidEndAt" dc:"竞价结束时间"`
}
// CreatePurchaseOrderRes 创建采购订单响应
type CreatePurchaseOrderRes struct {
ID *bson.ObjectID `json:"id"` // 采购订单ID
}
// UpdatePurchaseOrderReq 更新采购订单请求
type UpdatePurchaseOrderReq struct {
g.Meta `path:"/updatePurchaseOrder" method:"put" tags:"采购订单管理" summary:"更新采购订单" dc:"更新采购订单信息"`
ID *bson.ObjectID `json:"id" v:"required" dc:"采购订单ID"`
// 基础订单信息
Title string `json:"title" dc:"订单标题"`
Description string `json:"description" dc:"订单描述"`
OrderType consts.PurchaseOrderType `json:"orderType" dc:"订单类型"`
// 需求方信息
BuyerId *bson.ObjectID `json:"buyerId" dc:"采购方ID"`
BuyerName string `json:"buyerName" dc:"采购方名称"`
BuyerType string `json:"buyerType" dc:"采购方类型"`
// 通用状态信息
Status consts.PurchaseOrderStatus `json:"status" dc:"订单状态"`
Priority int `json:"priority" dc:"优先级"`
// 通用字段
ExpectedDelivery *gtime.Time `json:"expectedDelivery" dc:"期望交付时间"`
ExpiryTime *gtime.Time `json:"expiryTime" dc:"订单有效期/竞价结束时间"`
// 模式特定信息
DirectPurchase *UpdateDirectPurchaseReq `json:"directPurchase" dc:"指定供应商模式信息"`
BiddingInfo *UpdateBiddingReq `json:"biddingInfo" dc:"竞价模式信息"`
}
// UpdateDirectPurchaseReq 更新指定供应商模式信息
type UpdateDirectPurchaseReq struct {
SupplierId *bson.ObjectID `json:"supplierId" dc:"指定供应商ID"`
SupplierName string `json:"supplierName" dc:"指定供应商名称"`
SupplierCode string `json:"supplierCode" dc:"供应商编码"`
AssignReason string `json:"assignReason" dc:"指派原因"`
DeliveryAddress string `json:"deliveryAddress" dc:"交付地址"`
ContactPerson string `json:"contactPerson" dc:"联系人"`
ContactPhone string `json:"contactPhone" dc:"联系电话"`
ResponseStatus string `json:"responseStatus" dc:"供应商响应状态"`
}
// UpdateBiddingReq 更新竞价模式信息
type UpdateBiddingReq struct {
BidMode consts.BidMode `json:"bidMode" dc:"竞价模式"`
MinSuppliers int `json:"minSuppliers" dc:"最少参与供应商数"`
MaxSuppliers int `json:"maxSuppliers" dc:"最多参与供应商数"`
BidDuration int `json:"bidDuration" dc:"竞价持续时长(分钟)"`
BidSupplierCount int `json:"bidSupplierCount" dc:"参与竞价的供应商数量"`
BidStartAt *gtime.Time `json:"bidStartAt" dc:"竞价开始时间"`
BidEndAt *gtime.Time `json:"bidEndAt" dc:"竞价结束时间"`
}
// DeletePurchaseOrderReq 删除采购订单请求
type DeletePurchaseOrderReq struct {
g.Meta `path:"/deletePurchaseOrder" method:"delete" tags:"采购订单管理" summary:"删除采购订单" dc:"删除采购订单"`
ID *bson.ObjectID `json:"id" v:"required" dc:"采购订单ID"`
}
// GetPurchaseOrderReq 获取采购订单详情请求
type GetPurchaseOrderReq struct {
g.Meta `path:"/getPurchaseOrder" method:"get" tags:"采购订单管理" summary:"获取采购订单详情" dc:"获取采购订单详情"`
ID *bson.ObjectID `json:"id" v:"required" dc:"采购订单ID"`
}
// GetPurchaseOrderRes 获取采购订单详情响应
type GetPurchaseOrderRes struct {
ID *bson.ObjectID `json:"id"`
OrderNo string `json:"orderNo"`
Title string `json:"title"`
Description string `json:"description"`
OrderType consts.PurchaseOrderType `json:"orderType"`
BuyerId *bson.ObjectID `json:"buyerId"`
BuyerName string `json:"buyerName"`
BuyerType string `json:"buyerType"`
Status consts.PurchaseOrderStatus `json:"status"`
StatusText string `json:"statusText"`
Priority int `json:"priority"`
DirectPurchase *DirectPurchaseInfoRes `json:"directPurchase"`
BiddingInfo *BiddingInfoRes `json:"biddingInfo"`
ExpectedDelivery string `json:"expectedDelivery"`
ExpiryTime string `json:"expiryTime"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// DirectPurchaseInfoRes 指定供应商模式信息响应
type DirectPurchaseInfoRes struct {
SupplierId *bson.ObjectID `json:"supplierId"`
SupplierName string `json:"supplierName"`
SupplierCode string `json:"supplierCode"`
AssignReason string `json:"assignReason"`
DeliveryAddress string `json:"deliveryAddress"`
ContactPerson string `json:"contactPerson"`
ContactPhone string `json:"contactPhone"`
ResponseStatus string `json:"responseStatus"`
AssignedAt string `json:"assignedAt"`
AcceptedAt string `json:"acceptedAt"`
RejectedAt string `json:"rejectedAt"`
DeliveredAt string `json:"deliveredAt"`
}
// BiddingInfoRes 竞价模式信息响应
type BiddingInfoRes struct {
BidMode consts.BidMode `json:"bidMode"`
BidModeText string `json:"bidModeText"`
MinSuppliers int `json:"minSuppliers"`
MaxSuppliers int `json:"maxSuppliers"`
BidDuration int `json:"bidDuration"`
BidSupplierCount int `json:"bidSupplierCount"`
BidStartAt string `json:"bidStartAt"`
BidEndAt string `json:"bidEndAt"`
ResultPublishedAt string `json:"resultPublishedAt"`
}
// ListPurchaseOrdersReq 获取采购订单列表请求
type ListPurchaseOrdersReq struct {
g.Meta `path:"/listPurchaseOrders" method:"get" tags:"采购订单管理" summary:"获取采购订单列表" dc:"分页查询采购订单列表"`
OrderNo string `json:"orderNo" dc:"订单编号(精确查询)"`
Title string `json:"title" dc:"订单标题(模糊查询)"`
BuyerId *bson.ObjectID `json:"buyerId" dc:"采购方ID精确查询"`
OrderType consts.PurchaseOrderType `json:"orderType" dc:"订单类型"`
Status *consts.PurchaseOrderStatus `json:"status" dc:"订单状态"`
PageNum int `json:"pageNum" dc:"页码"`
PageSize int `json:"pageSize" dc:"每页大小"`
}
// ListPurchaseOrdersRes 获取采购订单列表响应
type ListPurchaseOrdersRes struct {
List []*PurchaseOrderListItem `json:"list" dc:"采购订单列表"`
Total int64 `json:"total" dc:"总数"`
}
// PurchaseOrderListItem 采购订单列表项
type PurchaseOrderListItem struct {
ID *bson.ObjectID `json:"id"`
OrderNo string `json:"orderNo"`
Title string `json:"title"`
OrderType consts.PurchaseOrderType `json:"orderType"`
OrderTypeText string `json:"orderTypeText"`
BuyerName string `json:"buyerName"`
BuyerType string `json:"buyerType"`
Status consts.PurchaseOrderStatus `json:"status"`
StatusText string `json:"statusText"`
Priority int `json:"priority"`
ExpectedDelivery string `json:"expectedDelivery"`
ExpiryTime string `json:"expiryTime"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// BatchCreatePurchaseOrdersReq 批量创建采购订单请求
type BatchCreatePurchaseOrdersReq struct {
g.Meta `path:"/batchCreatePurchaseOrders" method:"post" tags:"采购订单管理" summary:"批量创建采购订单" dc:"批量创建采购订单"`
Orders []CreatePurchaseOrderReq `json:"orders" v:"required" dc:"采购订单列表"`
}
// BatchCreatePurchaseOrdersRes 批量创建采购订单响应
type BatchCreatePurchaseOrdersRes struct {
IDs []*bson.ObjectID `json:"ids"` // 创建的ID列表
}

View File

@@ -0,0 +1,168 @@
package dto
import (
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// GeneratePurchaseOrderItemTestDataReq 生成采购订单明细测试数据请求
type GeneratePurchaseOrderItemTestDataReq struct {
g.Meta `path:"/generateTestData" method:"post" tags:"采购订单明细管理" summary:"生成测试数据" dc:"生成采购订单明细测试数据"`
}
// CreatePurchaseOrderItemReq 创建采购订单明细请求
type CreatePurchaseOrderItemReq struct {
g.Meta `path:"/createPurchaseOrderItem" method:"post" tags:"采购订单明细管理" summary:"创建采购订单明细" dc:"创建新的采购订单明细"`
// 关联信息
OrderId *bson.ObjectID `json:"orderId" v:"required" dc:"订单ID"`
AssetId *bson.ObjectID `json:"assetId" v:"required" dc:"资产ID"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
// 商品信息
ProductName string `json:"productName" v:"required" dc:"商品名称"`
Specification string `json:"specification" dc:"规格描述"`
Brand string `json:"brand" dc:"品牌"`
// 数量和价格
Quantity int `json:"quantity" v:"required|min:1" dc:"订购数量"`
Unit string `json:"unit" v:"required" dc:"单位"`
UnitPrice int `json:"unitPrice" v:"required|min:0" dc:"单价(分)"`
TotalPrice int `json:"totalPrice" v:"required|min:0" dc:"总价(分)"`
DiscountPrice int `json:"discountPrice" v:"min:0" dc:"折扣价(分)"`
// 要求信息
RequirementDesc string `json:"requirementDesc" dc:"特殊要求描述"`
DeliveryAddress string `json:"deliveryAddress" dc:"交付地址"`
}
// CreatePurchaseOrderItemRes 创建采购订单明细响应
type CreatePurchaseOrderItemRes struct {
ID *bson.ObjectID `json:"id"` // 采购订单明细ID
}
// UpdatePurchaseOrderItemReq 更新采购订单明细请求
type UpdatePurchaseOrderItemReq struct {
g.Meta `path:"/updatePurchaseOrderItem" method:"put" tags:"采购订单明细管理" summary:"更新采购订单明细" dc:"更新采购订单明细信息"`
ID *bson.ObjectID `json:"id" v:"required" dc:"采购订单明细ID"`
// 关联信息
AssetId *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
// 商品信息
ProductName string `json:"productName" dc:"商品名称"`
Specification string `json:"specification" dc:"规格描述"`
Brand string `json:"brand" dc:"品牌"`
// 数量和价格
Quantity int `json:"quantity" v:"min:1" dc:"订购数量"`
Unit string `json:"unit" dc:"单位"`
UnitPrice int `json:"unitPrice" v:"min:0" dc:"单价(分)"`
TotalPrice int `json:"totalPrice" v:"min:0" dc:"总价(分)"`
DiscountPrice int `json:"discountPrice" v:"min:0" dc:"折扣价(分)"`
// 签收和入库
PassQuantity int `json:"passQuantity" dc:"签收数量"`
InboundQty int `json:"inboundQty" dc:"已入库数量"`
// 要求信息
RequirementDesc string `json:"requirementDesc" dc:"特殊要求描述"`
DeliveryAddress string `json:"deliveryAddress" dc:"交付地址"`
}
// UpdatePurchaseOrderItemRes 更新采购订单明细响应
type UpdatePurchaseOrderItemRes struct {
ID *bson.ObjectID `json:"id"` // 采购订单明细ID
}
// DeletePurchaseOrderItemReq 删除采购订单明细请求
type DeletePurchaseOrderItemReq struct {
g.Meta `path:"/deletePurchaseOrderItem" method:"delete" tags:"采购订单明细管理" summary:"删除采购订单明细" dc:"删除采购订单明细"`
ID *bson.ObjectID `json:"id" v:"required" dc:"采购订单明细ID"`
}
// DeletePurchaseOrderItemRes 删除采购订单明细响应
type DeletePurchaseOrderItemRes struct {
ID *bson.ObjectID `json:"id"` // 采购订单明细ID
}
// GetPurchaseOrderItemReq 获取采购订单明细详情请求
type GetPurchaseOrderItemReq struct {
g.Meta `path:"/getPurchaseOrderItem" method:"get" tags:"采购订单明细管理" summary:"获取采购订单明细详情" dc:"获取采购订单明细详情"`
ID *bson.ObjectID `json:"id" v:"required" dc:"采购订单明细ID"`
}
// GetPurchaseOrderItemRes 获取采购订单明细详情响应
type GetPurchaseOrderItemRes struct {
ID *bson.ObjectID `json:"id"`
OrderId *bson.ObjectID `json:"orderId"`
AssetId *bson.ObjectID `json:"assetId"`
AssetSkuId *bson.ObjectID `json:"assetSkuId"`
ProductName string `json:"productName"`
Specification string `json:"specification"`
Brand string `json:"brand"`
Quantity int `json:"quantity"`
Unit string `json:"unit"`
UnitPrice int `json:"unitPrice"`
TotalPrice int `json:"totalPrice"`
DiscountPrice int `json:"discountPrice"`
RequirementDesc string `json:"requirementDesc"`
DeliveryAddress string `json:"deliveryAddress"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// ListPurchaseOrderItemsReq 获取采购订单明细列表请求
type ListPurchaseOrderItemsReq struct {
g.Meta `path:"/listPurchaseOrderItems" method:"get" tags:"采购订单明细管理" summary:"获取采购订单明细列表" dc:"分页查询采购订单明细列表"`
OrderId *bson.ObjectID `json:"orderId" dc:"订单ID精确查询"`
AssetId *bson.ObjectID `json:"assetId" dc:"资产ID精确查询"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID精确查询"`
ProductName string `json:"productName" dc:"商品名称(模糊查询)"`
Brand string `json:"brand" dc:"品牌(模糊查询)"`
PageNum int `json:"pageNum" dc:"页码"`
PageSize int `json:"pageSize" dc:"每页大小"`
}
// ListPurchaseOrderItemsRes 获取采购订单明细列表响应
type ListPurchaseOrderItemsRes struct {
List []*PurchaseOrderItemListItem `json:"list" dc:"采购订单明细列表"`
Total int64 `json:"total" dc:"总数"`
}
// PurchaseOrderItemListItem 采购订单明细列表项
type PurchaseOrderItemListItem struct {
ID *bson.ObjectID `json:"id"`
OrderId *bson.ObjectID `json:"orderId"`
AssetId *bson.ObjectID `json:"assetId"`
AssetSkuId *bson.ObjectID `json:"assetSkuId"`
ProductName string `json:"productName"`
Specification string `json:"specification"`
Brand string `json:"brand"`
Quantity int `json:"quantity"`
Unit string `json:"unit"`
UnitPrice int `json:"unitPrice"`
TotalPrice int `json:"totalPrice"`
DiscountPrice int `json:"discountPrice"`
RequirementDesc string `json:"requirementDesc"`
DeliveryAddress string `json:"deliveryAddress"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// BatchCreatePurchaseOrderItemsReq 批量创建采购订单明细请求
type BatchCreatePurchaseOrderItemsReq struct {
g.Meta `path:"/batchCreatePurchaseOrderItems" method:"post" tags:"采购订单明细管理" summary:"批量创建采购订单明细" dc:"批量创建采购订单明细"`
Items []CreatePurchaseOrderItemReq `json:"items" v:"required" dc:"采购订单明细列表"`
}
// BatchCreatePurchaseOrderItemsRes 批量创建采购订单明细响应
type BatchCreatePurchaseOrderItemsRes struct {
IDs []*bson.ObjectID `json:"ids"` // 创建的ID列表
}

View File

@@ -0,0 +1,253 @@
package dto
import (
"assets/consts/procurement"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// GenerateSupplierTestDataReq 生成供应商测试数据请求
type GenerateSupplierTestDataReq struct {
g.Meta `path:"/generateTestData" method:"post" tags:"供应商管理" summary:"生成测试数据" dc:"生成供应商测试数据"`
}
// CreateSupplierReq 创建供应商请求
type CreateSupplierReq struct {
g.Meta `path:"/createSupplier" method:"post" tags:"供应商管理" summary:"创建供应商" dc:"创建新的供应商(仅基础信息)"`
// 基础信息(最小必要字段)
Name string `json:"name" v:"required|max-length:100#供应商名称不能为空|供应商名称不能超过100个字符" dc:"供应商名称(必填)"`
Code string `json:"code" v:"required|max-length:50#供应商编码不能为空|供应商编码不能超过50个字符" dc:"供应商编码(必填)"`
ShortName string `json:"shortName" dc:"供应商简称"`
Alias []string `json:"alias" dc:"别名列表"`
Logo string `json:"logo" dc:"供应商LOGO URL"`
// 联系信息
Phone string `json:"phone" dc:"供应商电话"`
Mobile string `json:"mobile" dc:"手机号码"`
Email string `json:"email" dc:"邮箱地址"`
Website string `json:"website" dc:"官网地址"`
ContactPerson string `json:"contactPerson" dc:"联系人姓名"`
ContactPhone string `json:"contactPhone" dc:"联系人电话"`
ContactEmail string `json:"contactEmail" dc:"联系人邮箱"`
ContactPosition string `json:"contactPosition" dc:"联系人职位"`
// 地址信息
Country string `json:"country" dc:"国家"`
Province string `json:"province" dc:"省份"`
City string `json:"city" dc:"城市"`
District string `json:"district" dc:"区县"`
Address string `json:"address" dc:"详细地址"`
PostalCode string `json:"postalCode" dc:"邮政编码"`
// 企业资质信息
BusinessLicense string `json:"businessLicense" dc:"营业执照号"`
LegalPerson string `json:"legalPerson" dc:"法定代表人"`
TaxNumber string `json:"taxNumber" dc:"税务登记号"`
BankName string `json:"bankName" dc:"开户银行"`
BankAccount string `json:"bankAccount" dc:"银行账号"`
BankAccountName string `json:"bankAccountName" dc:"账户名称"`
// 业务合作信息
SupplierLevel string `json:"supplierLevel" dc:"供应商等级"`
PaymentMethod string `json:"paymentMethod" dc:"结算方式"`
PaymentPeriod int `json:"paymentPeriod" dc:"付款周期(天)"`
TaxRate float64 `json:"taxRate" dc:"税率如0.13表示13%"`
MinOrderAmount int `json:"minOrderAmount" dc:"最小订货金额(分)"`
// 经营品类信息
MainCategories []string `json:"mainCategories" dc:"主营品类ID列表"`
BusinessScope string `json:"businessScope" dc:"经营范围"`
// 状态信息
Status consts.SupplierStatus `json:"status" dc:"供应商状态"`
// 备注和标签
Remark string `json:"remark" dc:"备注信息"`
Tags []string `json:"tags" dc:"标签列表"`
}
// CreateSupplierRes 创建供应商响应
type CreateSupplierRes struct {
ID *bson.ObjectID `json:"id"` // 供应商ID
}
// BatchCreateSuppliersReq 批量创建供应商请求
type BatchCreateSuppliersReq struct {
g.Meta `path:"/batchCreateSuppliers" method:"post" tags:"供应商管理" summary:"批量创建供应商" dc:"批量创建供应商"`
Suppliers []CreateSupplierReq `json:"suppliers" v:"required" dc:"供应商列表"`
}
// BatchCreateSuppliersRes 批量创建供应商响应
type BatchCreateSuppliersRes struct {
IDs []*bson.ObjectID `json:"ids"` // 创建的ID列表
}
// UpdateSupplierReq 更新供应商请求
type UpdateSupplierReq struct {
g.Meta `path:"/updateSupplier" method:"put" tags:"供应商管理" summary:"更新供应商" dc:"更新供应商信息"`
ID *bson.ObjectID `json:"id" v:"required" dc:"供应商ID"`
// 基础信息
Name string `json:"name" dc:"供应商名称"`
Code string `json:"code" dc:"供应商编码"`
ShortName string `json:"shortName" dc:"供应商简称"`
Alias []string `json:"alias" dc:"别名列表"`
Logo string `json:"logo" dc:"供应商LOGO URL"`
// 联系信息
Phone string `json:"phone" dc:"供应商电话"`
Mobile string `json:"mobile" dc:"手机号码"`
Email string `json:"email" dc:"邮箱地址"`
Website string `json:"website" dc:"官网地址"`
ContactPerson string `json:"contactPerson" dc:"联系人姓名"`
ContactPhone string `json:"contactPhone" dc:"联系人电话"`
ContactEmail string `json:"contactEmail" dc:"联系人邮箱"`
ContactPosition string `json:"contactPosition" dc:"联系人职位"`
// 地址信息
Country string `json:"country" dc:"国家"`
Province string `json:"province" dc:"省份"`
City string `json:"city" dc:"城市"`
District string `json:"district" dc:"区县"`
Address string `json:"address" dc:"详细地址"`
PostalCode string `json:"postalCode" dc:"邮政编码"`
// 企业资质信息
BusinessLicense string `json:"businessLicense" dc:"营业执照号"`
LegalPerson string `json:"legalPerson" dc:"法定代表人"`
TaxNumber string `json:"taxNumber" dc:"税务登记号"`
BankName string `json:"bankName" dc:"开户银行"`
BankAccount string `json:"bankAccount" dc:"银行账号"`
BankAccountName string `json:"bankAccountName" dc:"账户名称"`
// 业务合作信息
SupplierLevel string `json:"supplierLevel" dc:"供应商等级"`
PaymentMethod string `json:"paymentMethod" dc:"结算方式"`
PaymentPeriod int `json:"paymentPeriod" dc:"付款周期(天)"`
TaxRate float64 `json:"taxRate" dc:"税率如0.13表示13%"`
MinOrderAmount int `json:"minOrderAmount" dc:"最小订货金额(分)"`
// 经营品类信息
MainCategories []string `json:"mainCategories" dc:"主营品类ID列表"`
BusinessScope string `json:"businessScope" dc:"经营范围"`
// 状态信息
Status consts.SupplierStatus `json:"status" dc:"供应商状态"`
// 备注和标签
Remark string `json:"remark" dc:"备注信息"`
Tags []string `json:"tags" dc:"标签列表"`
}
// DeleteSupplierReq 删除供应商请求
type DeleteSupplierReq struct {
g.Meta `path:"/deleteSupplier" method:"delete" tags:"供应商管理" summary:"删除供应商" dc:"删除供应商"`
ID *bson.ObjectID `json:"id" v:"required" dc:"供应商ID"`
}
// GetSupplierReq 获取供应商详情请求
type GetSupplierReq struct {
g.Meta `path:"/getSupplier" method:"get" tags:"供应商管理" summary:"获取供应商详情" dc:"获取供应商详情"`
ID *bson.ObjectID `json:"id" v:"required" dc:"供应商ID"`
}
// GetSupplierRes 获取供应商详情响应(简化版)
type GetSupplierRes struct {
ID *bson.ObjectID `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
ShortName string `json:"shortName"`
Alias []string `json:"alias"`
Logo string `json:"logo"`
Phone string `json:"phone"`
Mobile string `json:"mobile"`
Email string `json:"email"`
Website string `json:"website"`
ContactPerson string `json:"contactPerson"`
ContactPhone string `json:"contactPhone"`
ContactEmail string `json:"contactEmail"`
ContactPosition string `json:"contactPosition"`
Country string `json:"country"`
Province string `json:"province"`
City string `json:"city"`
District string `json:"district"`
Address string `json:"address"`
PostalCode string `json:"postalCode"`
BusinessLicense string `json:"businessLicense"`
LegalPerson string `json:"legalPerson"`
TaxNumber string `json:"taxNumber"`
BankName string `json:"bankName"`
BankAccount string `json:"bankAccount"`
BankAccountName string `json:"bankAccountName"`
SupplierLevel string `json:"supplierLevel"`
PaymentMethod string `json:"paymentMethod"`
PaymentPeriod int `json:"paymentPeriod"`
TaxRate float64 `json:"taxRate"`
MinOrderAmount int `json:"minOrderAmount"`
MainCategories []string `json:"mainCategories"`
BusinessScope string `json:"businessScope"`
Status consts.SupplierStatus `json:"status"`
StatusText string `json:"statusText"`
Rating float64 `json:"rating"`
DeliveryRating float64 `json:"deliveryRating"`
QualityRating float64 `json:"qualityRating"`
ServiceRating float64 `json:"serviceRating"`
TotalOrders int64 `json:"totalOrders"`
TotalAmount int64 `json:"totalAmount"`
Remark string `json:"remark"`
Tags []string `json:"tags"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// ListSuppliersReq 获取供应商列表请求
type ListSuppliersReq struct {
g.Meta `path:"/listSuppliers" method:"get" tags:"供应商管理" summary:"获取供应商列表" dc:"分页查询供应商列表"`
Name string `json:"name" dc:"供应商名称(模糊查询)"`
Code string `json:"code" dc:"供应商编码(精确查询)"`
Status *consts.SupplierStatus `json:"status" dc:"供应商状态"`
PageNum int `json:"pageNum" dc:"页码"`
PageSize int `json:"pageSize" dc:"每页大小"`
}
// ListSuppliersRes 获取供应商列表响应
type ListSuppliersRes struct {
List []*SupplierListItem `json:"list" dc:"供应商列表"`
Total int64 `json:"total" dc:"总数"`
}
// GetSupplierOptionsReq 获取供应商选项请求
type GetSupplierOptionsReq struct {
g.Meta `path:"/getSupplierOptions" method:"get" tags:"供应商管理" summary:"获取供应商选项" dc:"获取供应商选项(用于下拉选择)"`
}
// GetSupplierOptionsRes 获取供应商选项响应
type GetSupplierOptionsRes struct {
List []*SupplierListItem `json:"list" dc:"供应商选项列表"`
}
// SupplierListItem 供应商列表项(简化版)
type SupplierListItem struct {
ID *bson.ObjectID `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
ShortName string `json:"shortName"`
Logo string `json:"logo"`
Phone string `json:"phone"`
Mobile string `json:"mobile"`
Email string `json:"email"`
Website string `json:"website"`
Address string `json:"address"`
Status consts.SupplierStatus `json:"status"`
StatusText string `json:"statusText"`
Rating float64 `json:"rating"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}

View File

@@ -0,0 +1,110 @@
package dto
import (
"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"
)
// CreateInventoryCountAdjustHistoryReq 创建盘点调整历史请求
type CreateInventoryCountAdjustHistoryReq struct {
g.Meta `path:"/createInventoryCountAdjustHistory" method:"post" tags:"盘点调整历史管理" summary:"创建盘点调整历史" dc:"创建新的盘点调整历史记录"`
CountID *bson.ObjectID `json:"countId" v:"required" dc:"盘点任务ID"`
DetailID *bson.ObjectID `json:"detailId" v:"required" dc:"盘点明细ID"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" v:"required" dc:"商品SKU ID"`
WarehouseID *bson.ObjectID `json:"warehouseId" v:"required" dc:"仓库ID"`
ZoneID *bson.ObjectID `json:"zoneId" dc:"库区ID"`
LocationID *bson.ObjectID `json:"locationId" dc:"库位ID"`
BeforeQuantity int `json:"beforeQuantity" v:"required" dc:"调整前库存"`
AfterQuantity int `json:"afterQuantity" v:"required" dc:"调整后库存"`
Difference int `json:"difference" v:"required" dc:"差值"`
Reason string `json:"reason" dc:"调整原因"`
AdjustedBy string `json:"adjustedBy" dc:"调整人ID"`
AdjustedByName string `json:"adjustedByName" dc:"调整人姓名"`
BatchNo string `json:"batchNo" dc:"批次号"`
}
// CreateInventoryCountAdjustHistoryRes 创建盘点调整历史响应
type CreateInventoryCountAdjustHistoryRes struct {
Id *bson.ObjectID `json:"id" dc:"历史记录ID"`
}
// GetInventoryCountAdjustHistoryReq 获取盘点调整历史详情请求
type GetInventoryCountAdjustHistoryReq struct {
g.Meta `path:"/getInventoryCountAdjustHistory" method:"get" tags:"盘点调整历史管理" summary:"获取盘点调整历史详情" dc:"获取盘点调整历史详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"历史记录ID"`
}
// GetInventoryCountAdjustHistoryRes 获取盘点调整历史详情响应
type GetInventoryCountAdjustHistoryRes struct {
Id *bson.ObjectID `json:"id" dc:"历史记录ID"`
CountID *bson.ObjectID `json:"countId" dc:"盘点任务ID"`
DetailID *bson.ObjectID `json:"detailId" dc:"盘点明细ID"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"商品SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"商品SKU名称"`
WarehouseID *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneID *bson.ObjectID `json:"zoneId" dc:"库区ID"`
ZoneName string `json:"zoneName" dc:"库区名称"`
LocationID *bson.ObjectID `json:"locationId" dc:"库位ID"`
LocationName string `json:"locationName" dc:"库位名称"`
BeforeQuantity int `json:"beforeQuantity" dc:"调整前库存"`
AfterQuantity int `json:"afterQuantity" dc:"调整后库存"`
Difference int `json:"difference" dc:"差值"`
Reason string `json:"reason" dc:"调整原因"`
AdjustedBy string `json:"adjustedBy" dc:"调整人ID"`
AdjustedByName string `json:"adjustedByName" dc:"调整人姓名"`
AdjustedAt *gtime.Time `json:"adjustedAt" dc:"调整时间"`
BatchNo string `json:"batchNo" dc:"批次号"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// DeleteInventoryCountAdjustHistoryReq 删除盘点调整历史请求
type DeleteInventoryCountAdjustHistoryReq struct {
g.Meta `path:"/deleteInventoryCountAdjustHistory" method:"delete" tags:"盘点调整历史管理" summary:"删除盘点调整历史" dc:"删除盘点调整历史记录"`
Id *bson.ObjectID `json:"id" v:"required" dc:"历史记录ID"`
}
// DeleteInventoryCountAdjustHistoryRes 删除盘点调整历史响应
type DeleteInventoryCountAdjustHistoryRes struct {
Id *bson.ObjectID `json:"id" dc:"历史记录ID"`
}
// ListInventoryCountAdjustHistoryReq 获取盘点调整历史列表请求
type ListInventoryCountAdjustHistoryReq struct {
g.Meta `path:"/listInventoryCountAdjustHistories" method:"get" tags:"盘点调整历史管理" summary:"获取盘点调整历史列表" dc:"分页查询盘点调整历史列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
CountID string `json:"countId" dc:"盘点任务ID"`
DetailID string `json:"detailId" dc:"盘点明细ID"`
AssetSkuID string `json:"assetSkuId" dc:"商品SKU ID"`
WarehouseID string `json:"warehouseId" dc:"仓库ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
}
// ListInventoryCountAdjustHistoryRes 获取盘点调整历史列表响应
type ListInventoryCountAdjustHistoryRes struct {
List []InventoryCountAdjustHistoryListItem `json:"list" dc:"调整历史列表"`
Total int64 `json:"total" dc:"总数"`
}
// InventoryCountAdjustHistoryListItem 盘点调整历史列表项
type InventoryCountAdjustHistoryListItem struct {
Id *bson.ObjectID `json:"id" dc:"历史记录ID"`
CountID *bson.ObjectID `json:"countId" dc:"盘点任务ID"`
DetailID *bson.ObjectID `json:"detailId" dc:"盘点明细ID"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"商品SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"商品SKU名称"`
WarehouseID *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
BeforeQuantity int `json:"beforeQuantity" dc:"调整前库存"`
AfterQuantity int `json:"afterQuantity" dc:"调整后库存"`
Difference int `json:"difference" dc:"差值"`
Reason string `json:"reason" dc:"调整原因"`
AdjustedBy string `json:"adjustedBy" dc:"调整人ID"`
AdjustedByName string `json:"adjustedByName" dc:"调整人姓名"`
AdjustedAt *gtime.Time `json:"adjustedAt" dc:"调整时间"`
BatchNo string `json:"batchNo" dc:"批次号"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}

View File

@@ -0,0 +1,179 @@
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"
)
// CreateInventoryCountDetailReq 创建盘点明细请求
type CreateInventoryCountDetailReq struct {
g.Meta `path:"/createInventoryCountDetail" method:"post" tags:"盘点明细管理" summary:"创建盘点明细" dc:"创建新的盘点明细"`
CountID string `json:"countId" v:"required" dc:"盘点单ID"`
AssetID string `json:"assetId" v:"required" dc:"资产ID"`
AssetSkuID string `json:"assetSkuId" v:"required" dc:"资产SKU ID"`
WarehouseID string `json:"warehouseId" v:"required" dc:"仓库ID"`
ZoneID string `json:"zoneId" dc:"库区ID"`
LocationID string `json:"locationId" dc:"库位ID"`
BookQuantity int `json:"bookQuantity" v:"required" dc:"账面数量"`
BookBatchInfo map[string]int `json:"bookBatchInfo" dc:"账面批次信息"`
ActualQuantity int `json:"actualQuantity" dc:"实盘数量"`
ActualBatchInfo map[string]int `json:"actualBatchInfo" dc:"实盘批次信息"`
Remark string `json:"remark" dc:"备注"`
}
// CreateInventoryCountDetailRes 创建盘点明细响应
type CreateInventoryCountDetailRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点明细ID"`
}
// UpdateInventoryCountDetailReq 更新盘点明细请求
type UpdateInventoryCountDetailReq struct {
g.Meta `path:"/updateInventoryCountDetail" method:"put" tags:"盘点明细管理" summary:"更新盘点明细" dc:"更新盘点明细信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点明细ID"`
ActualQuantity *int `json:"actualQuantity" dc:"实盘数量"`
ActualBatchInfo map[string]int `json:"actualBatchInfo" dc:"实盘批次信息"`
DiscrepancyReason string `json:"discrepancyReason" dc:"差异原因"`
Status *stock.InventoryDetailStatus `json:"status" dc:"明细状态"`
Remark string `json:"remark" dc:"备注"`
}
// UpdateInventoryCountDetailRes 更新盘点明细响应
type UpdateInventoryCountDetailRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点明细ID"`
}
// DeleteInventoryCountDetailReq 删除盘点明细请求
type DeleteInventoryCountDetailReq struct {
g.Meta `path:"/deleteInventoryCountDetail" method:"delete" tags:"盘点明细管理" summary:"删除盘点明细" dc:"删除盘点明细"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点明细ID"`
}
// DeleteInventoryCountDetailRes 删除盘点明细响应
type DeleteInventoryCountDetailRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点明细ID"`
}
// GetInventoryCountDetailReq 获取盘点明细详情请求
type GetInventoryCountDetailReq struct {
g.Meta `path:"/getInventoryCountDetail" method:"get" tags:"盘点明细管理" summary:"获取盘点明细详情" dc:"获取盘点明细详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点明细ID"`
}
// GetInventoryCountDetailRes 获取盘点明细详情响应
type GetInventoryCountDetailRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点明细ID"`
CountID *bson.ObjectID `json:"countId" dc:"盘点单ID"`
CountNo string `json:"countNo" dc:"盘点单号"`
AssetID *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
WarehouseID *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneID *bson.ObjectID `json:"zoneId" dc:"库区ID"`
ZoneName string `json:"zoneName" dc:"库区名称"`
LocationID *bson.ObjectID `json:"locationId" dc:"库位ID"`
LocationName string `json:"locationName" dc:"库位名称"`
BookQuantity int `json:"bookQuantity" dc:"账面数量"`
BookBatchInfo map[string]int `json:"bookBatchInfo" dc:"账面批次信息"`
ActualQuantity int `json:"actualQuantity" dc:"实盘数量"`
ActualBatchInfo map[string]int `json:"actualBatchInfo" dc:"实盘批次信息"`
CountBy string `json:"countBy" dc:"盘点人ID"`
CountByName string `json:"countByName" dc:"盘点人名称"`
CountAt *gtime.Time `json:"countAt" dc:"盘点时间"`
Difference int `json:"difference" dc:"差异数量"`
DifferenceRate float64 `json:"differenceRate" dc:"差异率"`
DiscrepancyType stock.DiscrepancyType `json:"discrepancyType" dc:"差异类型"`
DiscrepancyTypeText string `json:"discrepancyTypeText" dc:"差异类型文本"`
DiscrepancyReason string `json:"discrepancyReason" dc:"差异原因"`
Status stock.InventoryDetailStatus `json:"status" dc:"明细状态"`
StatusText string `json:"statusText" dc:"状态文本"`
IsAdjusted bool `json:"isAdjusted" dc:"是否已调整"`
AdjustedAt *gtime.Time `json:"adjustedAt" dc:"调整时间"`
AdjustedBy string `json:"adjustedBy" dc:"调整人ID"`
AdjustedByName string `json:"adjustedByName" dc:"调整人名称"`
Remark string `json:"remark" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListInventoryCountDetailReq 获取盘点明细列表请求
type ListInventoryCountDetailReq struct {
g.Meta `path:"/listInventoryCountDetails" method:"get" tags:"盘点明细管理" summary:"获取盘点明细列表" dc:"分页查询盘点明细列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
CountID string `json:"countId" v:"required" dc:"盘点单ID"`
AssetID string `json:"assetId" dc:"资产ID"`
AssetSkuID string `json:"assetSkuId" dc:"资产SKU ID"`
WarehouseID string `json:"warehouseId" dc:"仓库ID"`
ZoneID string `json:"zoneId" dc:"库区ID"`
LocationID string `json:"locationId" dc:"库位ID"`
DiscrepancyType *stock.DiscrepancyType `json:"discrepancyType" dc:"差异类型"`
Status *stock.InventoryDetailStatus `json:"status" dc:"明细状态"`
IsAdjusted *bool `json:"isAdjusted" dc:"是否已调整"`
Keyword string `json:"keyword" dc:"关键词搜索"`
}
// ListInventoryCountDetailRes 获取盘点明细列表响应
type ListInventoryCountDetailRes struct {
List []InventoryCountDetailListItem `json:"list" dc:"盘点明细列表"`
Total int64 `json:"total" dc:"总数"`
}
// InventoryCountDetailListItem 盘点明细列表项
type InventoryCountDetailListItem struct {
Id *bson.ObjectID `json:"id" dc:"盘点明细ID"`
CountID *bson.ObjectID `json:"countId" dc:"盘点单ID"`
AssetID *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
WarehouseID *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
ZoneID *bson.ObjectID `json:"zoneId" dc:"库区ID"`
ZoneName string `json:"zoneName" dc:"库区名称"`
LocationID *bson.ObjectID `json:"locationId" dc:"库位ID"`
LocationName string `json:"locationName" dc:"库位名称"`
BookQuantity int `json:"bookQuantity" dc:"账面数量"`
ActualQuantity int `json:"actualQuantity" dc:"实盘数量"`
Difference int `json:"difference" dc:"差异数量"`
DifferenceRate float64 `json:"differenceRate" dc:"差异率"`
DiscrepancyType stock.DiscrepancyType `json:"discrepancyType" dc:"差异类型"`
DiscrepancyTypeText string `json:"discrepancyTypeText" dc:"差异类型文本"`
Status stock.InventoryDetailStatus `json:"status" dc:"明细状态"`
StatusText string `json:"statusText" dc:"状态文本"`
IsAdjusted bool `json:"isAdjusted" dc:"是否已调整"`
CountBy string `json:"countBy" dc:"盘点人ID"`
CountByName string `json:"countByName" dc:"盘点人名称"`
CountAt *gtime.Time `json:"countAt" dc:"盘点时间"`
Remark string `json:"remark" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// SearchSimilarAssetsReq 查询相似商品请求
type SearchSimilarAssetsReq struct {
g.Meta `path:"/searchSimilarAssets" method:"get" tags:"盘点明细管理" summary:"查询相似商品" dc:"单字模糊查询相似商品"`
Keyword string `json:"keyword" v:"required" dc:"关键词"`
WarehouseID *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
}
// SearchSimilarAssetsRes 查询相似商品响应
type SearchSimilarAssetsRes struct {
List []SimilarAssetItem `json:"list" dc:"相似商品列表"`
}
// SimilarAssetItem 相似商品项
type SimilarAssetItem struct {
AssetID *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
AvailableQty int `json:"availableQty" dc:"可用库存"`
WarehouseID *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
WarehouseName string `json:"warehouseName" dc:"仓库名称"`
}

View File

@@ -0,0 +1,202 @@
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"
)
// CreateInventoryCountReq 创建盘点任务请求
type CreateInventoryCountReq struct {
g.Meta `path:"/createInventoryCount" method:"post" tags:"盘点管理" summary:"创建盘点任务" dc:"创建新的盘点任务"`
Title string `json:"title" v:"required|max-length:200#盘点标题不能为空|盘点标题不能超过200个字符" dc:"盘点标题"`
Description string `json:"description" dc:"盘点描述"`
WarehouseIDs []string `json:"warehouseId" dc:"仓库ID列表按仓库/库区/库位盘点时必填)"`
ZoneIDs []string `json:"zoneId" dc:"库区ID列表可选"`
LocationIDs []string `json:"locationId" dc:"库位ID列表可选"`
AssetSkuIDs []string `json:"assetSkuId" dc:"资产SKU ID列表可选"`
CountType stock.InventoryCountType `json:"countType" v:"required" dc:"盘点类型"`
Scope stock.InventoryCountScope `json:"scope" v:"required" dc:"盘点范围"`
AssigneeID string `json:"assigneeId" v:"required" dc:"负责人ID"`
AssigneeName string `json:"assigneeName" dc:"负责人名称"`
Participants []string `json:"participants" dc:"参与人员ID列表"`
Remark string `json:"remark" dc:"备注"`
}
// CreateInventoryCountRes 创建盘点任务响应
type CreateInventoryCountRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
CountNo string `json:"countNo" dc:"盘点单号"`
}
// UpdateInventoryCountReq 更新盘点任务请求
type UpdateInventoryCountReq struct {
g.Meta `path:"/updateInventoryCount" method:"put" tags:"盘点管理" summary:"更新盘点任务" dc:"更新盘点任务信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
Title string `json:"title" dc:"盘点标题"`
Description string `json:"description" dc:"盘点描述"`
AssigneeID string `json:"assigneeId" dc:"负责人ID"`
AssigneeName string `json:"assigneeName" dc:"负责人名称"`
Participants []string `json:"participants" dc:"参与人员ID列表"`
Status *stock.InventoryCountStatus `json:"status" dc:"盘点状态"`
Remark string `json:"remark" dc:"备注"`
}
// UpdateInventoryCountRes 更新盘点任务响应
type UpdateInventoryCountRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
}
// DeleteInventoryCountReq 删除盘点任务请求
type DeleteInventoryCountReq struct {
g.Meta `path:"/deleteInventoryCount" method:"delete" tags:"盘点管理" summary:"删除盘点任务" dc:"删除盘点任务"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
}
// DeleteInventoryCountRes 删除盘点任务响应
type DeleteInventoryCountRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
}
// GetInventoryCountReq 获取盘点任务详情请求
type GetInventoryCountReq struct {
g.Meta `path:"/getInventoryCount" method:"get" tags:"盘点管理" summary:"获取盘点任务详情" dc:"获取盘点任务详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
}
// GetInventoryCountRes 获取盘点任务详情响应
type GetInventoryCountRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
CountNo string `json:"countNo" dc:"盘点单号"`
Title string `json:"title" dc:"盘点标题"`
Description string `json:"description" dc:"盘点描述"`
WarehouseIDs []*bson.ObjectID `json:"warehouseIds" dc:"仓库ID列表"`
WarehouseNames []string `json:"warehouseNames" dc:"仓库名称列表"`
ZoneIDs []*bson.ObjectID `json:"zoneIds" dc:"库区ID列表"`
ZoneNames []string `json:"zoneNames" dc:"库区名称列表"`
LocationIDs []*bson.ObjectID `json:"locationIds" dc:"库位ID列表"`
LocationNames []string `json:"locationNames" dc:"库位名称列表"`
AssetSkuIDs []*bson.ObjectID `json:"assetSkuIds" dc:"资产SKU ID列表"`
AssetSkuNames []string `json:"assetSkuNames" dc:"资产SKU名称列表"`
CountType stock.InventoryCountType `json:"countType" dc:"盘点类型"`
CountTypeText string `json:"countTypeText" dc:"盘点类型文本"`
Scope stock.InventoryCountScope `json:"scope" dc:"盘点范围"`
ScopeText string `json:"scopeText" dc:"盘点范围文本"`
ActualStartTime *gtime.Time `json:"actualStartTime" dc:"实际开始时间"`
ActualEndTime *gtime.Time `json:"actualEndTime" dc:"实际结束时间"`
Status stock.InventoryCountStatus `json:"status" dc:"盘点状态"`
StatusText string `json:"statusText" dc:"状态文本"`
Progress float64 `json:"progress" dc:"进度百分比"`
CreatorID string `json:"creatorId" dc:"创建人ID"`
CreatorName string `json:"creatorName" dc:"创建人名称"`
AssigneeID string `json:"assigneeId" dc:"负责人ID"`
AssigneeName string `json:"assigneeName" dc:"负责人名称"`
Participants []string `json:"participants" dc:"参与人员ID列表"`
ParticipantNames []string `json:"participantNames" dc:"参与人员名称列表"`
TotalItems int `json:"totalItems" dc:"盘点条目总数"`
CompletedItems int `json:"completedItems" dc:"已完成条目数"`
DiscrepancyItems int `json:"discrepancyItems" dc:"有差异条目数"`
Remark string `json:"remark" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListInventoryCountReq 获取盘点任务列表请求
type ListInventoryCountReq struct {
g.Meta `path:"/listInventoryCounts" 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列表批量查询"`
CountType *stock.InventoryCountType `json:"countType" dc:"盘点类型"`
Status *stock.InventoryCountStatus `json:"status" dc:"盘点状态"`
AssigneeID string `json:"assigneeId" dc:"负责人ID"`
StartDate string `json:"startDate" dc:"开始日期"`
EndDate string `json:"endDate" dc:"结束日期"`
Keyword string `json:"keyword" dc:"关键词搜索(单号/标题)"`
}
// ListInventoryCountRes 获取盘点任务列表响应
type ListInventoryCountRes struct {
List []InventoryCountListItem `json:"list" dc:"盘点任务列表"`
Total int64 `json:"total" dc:"总数"`
}
// InventoryCountListItem 盘点任务列表项
type InventoryCountListItem struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
CountNo string `json:"countNo" dc:"盘点单号"`
Title string `json:"title" dc:"盘点标题"`
WarehouseIDs []*bson.ObjectID `json:"warehouseIds" dc:"仓库ID列表"`
WarehouseNames []string `json:"warehouseNames" dc:"仓库名称列表"`
ZoneIDs []*bson.ObjectID `json:"zoneIds" dc:"库区ID列表"`
ZoneNames []string `json:"zoneNames" dc:"库区名称列表"`
CountType stock.InventoryCountType `json:"countType" dc:"盘点类型"`
CountTypeText string `json:"countTypeText" dc:"盘点类型文本"`
Scope stock.InventoryCountScope `json:"scope" dc:"盘点范围"`
ScopeText string `json:"scopeText" dc:"盘点范围文本"`
Status stock.InventoryCountStatus `json:"status" dc:"盘点状态"`
StatusText string `json:"statusText" dc:"状态文本"`
Progress float64 `json:"progress" dc:"进度百分比"`
AssigneeID string `json:"assigneeId" dc:"负责人ID"`
AssigneeName string `json:"assigneeName" dc:"负责人名称"`
ActualStartTime *gtime.Time `json:"actualStartTime" dc:"实际开始时间"`
ActualEndTime *gtime.Time `json:"actualEndTime" dc:"实际结束时间"`
TotalItems int `json:"totalItems" dc:"盘点条目总数"`
CompletedItems int `json:"completedItems" dc:"已完成条目数"`
DiscrepancyItems int `json:"discrepancyItems" dc:"有差异条目数"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// CompleteInventoryCountReq 完成盘点请求
type CompleteInventoryCountReq struct {
g.Meta `path:"/completeInventoryCount" method:"post" tags:"盘点管理" summary:"完成盘点" dc:"完成盘点任务"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
}
// CompleteInventoryCountRes 完成盘点响应
type CompleteInventoryCountRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
}
// ExportInventoryCountTemplateReq 导出盘点模板请求
type ExportInventoryCountTemplateReq struct {
g.Meta `path:"/exportInventoryCountTemplate" method:"get" tags:"盘点管理" summary:"导出盘点模板" dc:"导出Excel盘点模板明盘/盲盘)"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
}
// CancelInventoryCountReq 取消盘点请求
type CancelInventoryCountReq struct {
g.Meta `path:"/cancelInventoryCount" method:"post" tags:"盘点管理" summary:"取消盘点" dc:"取消盘点任务"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
Reason string `json:"reason" dc:"取消原因"`
}
// CancelInventoryCountRes 取消盘点响应
type CancelInventoryCountRes struct {
Id *bson.ObjectID `json:"id" dc:"盘点任务ID"`
}
// ExportInventoryCountTemplateRes 导出盘点模板响应
type ExportInventoryCountTemplateRes struct {
FileName string `json:"fileName" dc:"文件名"`
FileData []byte `json:"fileData" dc:"文件数据(Base64编码)"`
}
// ImportInventoryCountReq 上传盘点Excel请求
type ImportInventoryCountReq struct {
g.Meta `path:"/importInventoryCount" method:"post" tags:"盘点管理" summary:"上传盘点Excel" dc:"上传盘点结果Excel"`
Id *bson.ObjectID `json:"id" v:"required" dc:"盘点任务ID"`
}
// ImportInventoryCountRes 上传盘点Excel响应
type ImportInventoryCountRes struct {
SuccessCount int `json:"successCount" dc:"成功导入数量"`
FailCount int `json:"failCount" dc:"失败数量"`
}

View File

@@ -0,0 +1 @@
package dto

View File

@@ -0,0 +1 @@
package dto

View File

@@ -0,0 +1,214 @@
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"
)
// CreateInventoryWarningReq 创建库存预警请求
type CreateInventoryWarningReq struct {
g.Meta `path:"/createInventoryWarning" method:"post" tags:"库存预警管理" summary:"创建库存预警" dc:"创建新的库存预警"`
WarningType stock.WarningType `json:"warningType" v:"required" dc:"预警类型"`
BatchID *bson.ObjectID `json:"batchId" v:"required" dc:"关联批次ID"`
AssetID *bson.ObjectID `json:"assetId" dc:"关联资产ID"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"关联资产SKU ID"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"关联供应商ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
BatchQty int `json:"batchQty" dc:"批次数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间"`
MinStockThreshold int `json:"minStockThreshold" dc:"最低库存阈值"`
Status stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
ProcessedAt *gtime.Time `json:"processedAt" dc:"处理时间"`
Processor string `json:"processor" dc:"处理人"`
ProcessNote string `json:"processNote" dc:"处理备注"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
PromotionPlanID string `json:"promotionPlanId" dc:"促销方案ID"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
Notes string `json:"notes" dc:"备注"`
}
// CreateInventoryWarningRes 创建库存预警响应
type CreateInventoryWarningRes struct {
Id *bson.ObjectID `json:"id" dc:"预警ID"`
}
// UpdateInventoryWarningReq 更新库存预警请求
type UpdateInventoryWarningReq struct {
g.Meta `path:"/updateInventoryWarning" method:"put" tags:"库存预警管理" summary:"更新库存预警" dc:"更新库存预警信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"预警ID"`
WarningType stock.WarningType `json:"warningType" v:"required" dc:"预警类型"`
BatchID *bson.ObjectID `json:"batchId" v:"required" dc:"关联批次ID"`
AssetID *bson.ObjectID `json:"assetId" dc:"关联资产ID"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"关联资产SKU ID"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"关联供应商ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
BatchQty int `json:"batchQty" dc:"批次数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间"`
MinStockThreshold int `json:"minStockThreshold" dc:"最低库存阈值"`
Status stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
ProcessedAt *gtime.Time `json:"processedAt" dc:"处理时间"`
Processor string `json:"processor" dc:"处理人"`
ProcessNote string `json:"processNote" dc:"处理备注"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
PromotionPlanID string `json:"promotionPlanId" dc:"促销方案ID"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
Notes string `json:"notes" dc:"备注"`
}
// UpdateInventoryWarningRes 更新库存预警响应
type UpdateInventoryWarningRes struct {
Id *bson.ObjectID `json:"id" dc:"预警ID"`
}
// DeleteInventoryWarningReq 删除库存预警请求
type DeleteInventoryWarningReq struct {
g.Meta `path:"/deleteInventoryWarning" method:"delete" tags:"库存预警管理" summary:"删除库存预警" dc:"删除库存预警"`
Id *bson.ObjectID `json:"id" v:"required" dc:"预警ID"`
}
// DeleteInventoryWarningRes 删除库存预警响应
type DeleteInventoryWarningRes struct {
Id *bson.ObjectID `json:"id" dc:"预警ID"`
}
// GetInventoryWarningReq 获取库存预警详情请求
type GetInventoryWarningReq struct {
g.Meta `path:"/getInventoryWarning" method:"get" tags:"库存预警管理" summary:"获取库存预警详情" dc:"获取库存预警详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"预警ID"`
}
// GetInventoryWarningRes 获取库存预警详情响应
type GetInventoryWarningRes struct {
Id *bson.ObjectID `json:"id" dc:"预警ID"`
WarningType stock.WarningType `json:"warningType" dc:"预警类型"`
WarningTypeText string `json:"warningTypeText" dc:"预警类型文本"`
BatchID *bson.ObjectID `json:"batchId" dc:"关联批次ID"`
AssetID *bson.ObjectID `json:"assetId" dc:"关联资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"关联资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"关联供应商ID"`
SupplierName string `json:"supplierName" dc:"供应商名称"`
BatchNo string `json:"batchNo" dc:"批次号"`
BatchQty int `json:"batchQty" dc:"批次数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间"`
MinStockThreshold int `json:"minStockThreshold" dc:"最低库存阈值"`
Status stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
StatusText string `json:"statusText" dc:"状态文本"`
ProcessedAt *gtime.Time `json:"processedAt" dc:"处理时间"`
Processor string `json:"processor" dc:"处理人"`
ProcessorName string `json:"processorName" dc:"处理人名称"`
ProcessNote string `json:"processNote" dc:"处理备注"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
ProcessMethodText string `json:"processMethodText" dc:"处理方式文本"`
PromotionPlanID string `json:"promotionPlanId" dc:"促销方案ID"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
Notes string `json:"notes" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListInventoryWarningReq 获取库存预警列表请求
type ListInventoryWarningReq struct {
g.Meta `path:"/listInventoryWarnings" method:"get" tags:"库存预警管理" summary:"获取库存预警列表" dc:"分页查询库存预警列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
WarningType *stock.WarningType `json:"warningType" dc:"预警类型"`
BatchID string `json:"batchId" dc:"关联批次ID单个兼容旧版"`
BatchIDs []string `json:"batchIds" dc:"批次ID列表批量查询"`
AssetID string `json:"assetId" dc:"关联资产ID单个兼容旧版"`
AssetIDs []string `json:"assetIds" dc:"资产ID列表批量查询"`
AssetSkuID string `json:"assetSkuId" dc:"关联资产SKU ID单个兼容旧版"`
AssetSkuIDs []string `json:"assetSkuIds" dc:"资产SKU ID列表批量查询"`
SupplierID string `json:"supplierId" dc:"关联供应商ID单个兼容旧版"`
SupplierIDs []string `json:"supplierIds" dc:"供应商ID列表批量查询"`
Status *stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
SupportsRecycle *bool `json:"supportsRecycle" dc:"是否支持回收"`
StartDate string `json:"startDate" dc:"开始日期"`
EndDate string `json:"endDate" dc:"结束日期"`
Keyword string `json:"keyword" dc:"关键词搜索(批次号/备注)"`
}
// ListInventoryWarningRes 获取库存预警列表响应
type ListInventoryWarningRes struct {
List []InventoryWarningListItem `json:"list" dc:"库存预警列表"`
Total int64 `json:"total" dc:"总数"`
}
// InventoryWarningListItem 库存预警列表项
type InventoryWarningListItem struct {
Id *bson.ObjectID `json:"id" dc:"预警ID"`
WarningType stock.WarningType `json:"warningType" dc:"预警类型"`
WarningTypeText string `json:"warningTypeText" dc:"预警类型文本"`
BatchID *bson.ObjectID `json:"batchId" dc:"关联批次ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
AssetID *bson.ObjectID `json:"assetId" dc:"关联资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"关联资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"关联供应商ID"`
SupplierName string `json:"supplierName" dc:"供应商名称"`
BatchQty int `json:"batchQty" dc:"批次数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
MinStockThreshold int `json:"minStockThreshold" dc:"最低库存阈值"`
Status stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
StatusText string `json:"statusText" dc:"状态文本"`
ProcessedAt *gtime.Time `json:"processedAt" dc:"处理时间"`
Processor string `json:"processor" dc:"处理人"`
ProcessorName string `json:"processorName" dc:"处理人名称"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
ProcessMethodText string `json:"processMethodText" dc:"处理方式文本"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// ProcessInventoryWarningReq 处理库存预警请求
type ProcessInventoryWarningReq struct {
g.Meta `path:"/processInventoryWarning" method:"post" tags:"库存预警管理" summary:"处理库存预警" dc:"处理库存预警"`
Id *bson.ObjectID `json:"id" v:"required" dc:"预警ID"`
Status stock.ExpiryMessageStatus `json:"status" v:"required" dc:"处理状态"`
Processor string `json:"processor" v:"required" dc:"处理人"`
ProcessNote string `json:"processNote" dc:"处理备注"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
PromotionPlanID string `json:"promotionPlanId" dc:"促销方案ID"`
}
// ProcessInventoryWarningRes 处理库存预警响应
type ProcessInventoryWarningRes struct {
Id *bson.ObjectID `json:"id" dc:"预警ID"`
}

View File

@@ -0,0 +1,117 @@
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"
)
// GetInventoryWarningHistoryReq 获取预警历史详情请求
type GetInventoryWarningHistoryReq struct {
g.Meta `path:"/getInventoryWarningHistory" method:"get" tags:"预警历史管理" summary:"获取预警历史详情" dc:"获取预警历史详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"预警历史ID"`
}
// GetInventoryWarningHistoryRes 获取预警历史详情响应
type GetInventoryWarningHistoryRes struct {
Id *bson.ObjectID `json:"id" dc:"预警历史ID"`
WarningType stock.WarningType `json:"warningType" dc:"预警类型"`
WarningTypeText string `json:"warningTypeText" dc:"预警类型文本"`
BatchID *bson.ObjectID `json:"batchId" dc:"批次ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
AssetID *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"供应商ID"`
SupplierName string `json:"supplierName" dc:"供应商名称"`
BatchQty int `json:"batchQty" dc:"批次数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间"`
MinStockThreshold int `json:"minStockThreshold" dc:"最低库存阈值"`
Status stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
StatusText string `json:"statusText" dc:"状态文本"`
ProcessedAt *gtime.Time `json:"processedAt" dc:"处理时间"`
Processor string `json:"processor" dc:"处理人"`
ProcessorName string `json:"processorName" dc:"处理人名称"`
ProcessNote string `json:"processNote" dc:"处理备注"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
ProcessMethodText string `json:"processMethodText" dc:"处理方式文本"`
PromotionPlanID *bson.ObjectID `json:"promotionPlanId" dc:"促销方案ID"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
Notes string `json:"notes" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
// ListInventoryWarningHistoryReq 获取预警历史列表请求
type ListInventoryWarningHistoryReq struct {
g.Meta `path:"/listInventoryWarningHistories" method:"get" tags:"预警历史管理" summary:"获取预警历史列表" dc:"分页查询预警历史列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
WarningType *stock.WarningType `json:"warningType" dc:"预警类型"`
BatchID string `json:"batchId" dc:"批次ID单个兼容旧版"`
BatchIDs []string `json:"batchIds" dc:"批次ID列表批量查询"`
AssetID string `json:"assetId" dc:"资产ID单个兼容旧版"`
AssetIDs []string `json:"assetIds" dc:"资产ID列表批量查询"`
AssetSkuID string `json:"assetSkuId" dc:"资产SKU ID单个兼容旧版"`
AssetSkuIDs []string `json:"assetSkuIds" dc:"资产SKU ID列表批量查询"`
SupplierID string `json:"supplierId" dc:"供应商ID单个兼容旧版"`
SupplierIDs []string `json:"supplierIds" dc:"供应商ID列表批量查询"`
Status *stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
StartDate string `json:"startDate" dc:"开始日期"`
EndDate string `json:"endDate" dc:"结束日期"`
Keyword string `json:"keyword" dc:"关键词搜索(批次号)"`
}
// ListInventoryWarningHistoryRes 获取预警历史列表响应
type ListInventoryWarningHistoryRes struct {
List []InventoryWarningHistoryListItem `json:"list" dc:"预警历史列表"`
Total int64 `json:"total" dc:"总数"`
}
// InventoryWarningHistoryListItem 预警历史列表项
type InventoryWarningHistoryListItem struct {
Id *bson.ObjectID `json:"id" dc:"预警历史ID"`
WarningType stock.WarningType `json:"warningType" dc:"预警类型"`
WarningTypeText string `json:"warningTypeText" dc:"预警类型文本"`
BatchID *bson.ObjectID `json:"batchId" dc:"批次ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
AssetID *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetName string `json:"assetName" dc:"资产名称"`
AssetSkuID *bson.ObjectID `json:"assetSkuId" dc:"资产SKU ID"`
AssetSkuName string `json:"assetSkuName" dc:"资产SKU名称"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"供应商ID"`
SupplierName string `json:"supplierName" dc:"供应商名称"`
BatchQty int `json:"batchQty" dc:"批次数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
MinStockThreshold int `json:"minStockThreshold" dc:"最低库存阈值"`
Status stock.ExpiryMessageStatus `json:"status" dc:"消息状态"`
StatusText string `json:"statusText" dc:"状态文本"`
ProcessedAt *gtime.Time `json:"processedAt" dc:"处理时间"`
Processor string `json:"processor" dc:"处理人"`
ProcessorName string `json:"processorName" dc:"处理人名称"`
ProcessMethod *stock.ExpiryProcessMethod `json:"processMethod" dc:"处理方式"`
ProcessMethodText string `json:"processMethodText" dc:"处理方式文本"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
// DeleteInventoryWarningHistoryReq 删除预警历史请求
type DeleteInventoryWarningHistoryReq struct {
g.Meta `path:"/deleteInventoryWarningHistory" method:"delete" tags:"预警历史管理" summary:"删除预警历史" dc:"删除预警历史记录"`
Id *bson.ObjectID `json:"id" v:"required" dc:"预警历史ID"`
}
// DeleteInventoryWarningHistoryRes 删除预警历史响应
type DeleteInventoryWarningHistoryRes struct {
Id *bson.ObjectID `json:"id" dc:"预警历史ID"`
}

View File

@@ -0,0 +1,136 @@
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:"更新时间"`
}

View File

@@ -0,0 +1,137 @@
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"
)
// CreatePrivateStockReq 创建实物库存批次请求
type CreatePrivateStockReq struct {
g.Meta `path:"/createPrivateStock" method:"post" tags:"实物库存批次管理" summary:"创建实物库存批次" dc:"创建新的实物库存批次"`
WarehouseId *bson.ObjectID `json:"warehouseId" v:"required" dc:"仓库ID"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
LocationId *bson.ObjectID `json:"locationId" dc:"库位ID"`
PrivateSkuID *bson.ObjectID `json:"privateSkuId" v:"required" dc:"私域SKU ID"`
BatchNo string `json:"batchNo" v:"required" dc:"批次号"`
BatchQty int `json:"batchQty" v:"required|min:1" dc:"批次总数量"`
AvailableQty int `json:"availableQty" v:"required|min:0" dc:"可用数量"`
BatchStatus *stock.BatchStatus `json:"batchStatus" dc:"批次状态"`
StockStatus *stock.StockStatus `json:"stockStatus" dc:"库存状态"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"供应商ID"`
SupportsRecycle bool `json:"supportsRecycle" dc:"是否支持回收"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"私域分类路径"`
StockType stock.StockLocationType `json:"stockType" dc:"库存类型"`
}
// CreatePrivateStockRes 创建实物库存批次响应
type CreatePrivateStockRes struct {
Id *bson.ObjectID `json:"id"`
}
// UpdatePrivateStockReq 更新实物库存批次请求
type UpdatePrivateStockReq struct {
g.Meta `path:"/updatePrivateStock" method:"put" tags:"实物库存批次管理" summary:"更新实物库存批次" dc:"更新实物库存批次信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"实物库存批次ID"`
WarehouseId *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
LocationId *bson.ObjectID `json:"locationId" dc:"库位ID"`
PrivateSkuID *bson.ObjectID `json:"privateSkuId" dc:"私域SKU ID"`
BatchNo string `json:"batchNo" dc:"批次号"`
BatchQty int `json:"batchQty" dc:"批次总数量"`
AvailableQty int `json:"availableQty" dc:"可用数量"`
BatchStatus *stock.BatchStatus `json:"batchStatus" dc:"批次状态"`
StockStatus *stock.StockStatus `json:"stockStatus" dc:"库存状态"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"供应商ID"`
SupportsRecycle *bool `json:"supportsRecycle" dc:"是否支持回收"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"私域分类路径"`
StockType stock.StockLocationType `json:"stockType" dc:"库存类型"`
}
// DeletePrivateStockReq 删除私域库存请求
type DeletePrivateStockReq struct {
g.Meta `path:"/deletePrivateStock" method:"delete" tags:"私域库存管理" summary:"删除私域库存" dc:"删除私域库存"`
Id *bson.ObjectID `json:"id" v:"required" dc:"私域库存ID"`
}
// GetPrivateStockReq 获取私域库存详情请求
type GetPrivateStockReq struct {
g.Meta `path:"/getPrivateStock" method:"get" tags:"私域库存管理" summary:"获取私域库存详情" dc:"获取私域库存详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"私域库存ID"`
}
// GetPrivateStockRes 获取私域库存详情响应
type GetPrivateStockRes struct {
Id *bson.ObjectID `json:"id"`
StockType stock.StockLocationType `json:"stockType"`
WarehouseId *bson.ObjectID `json:"warehouseId"`
WarehouseCode string `json:"warehouseCode"`
WarehouseName string `json:"warehouseName"`
ZoneId *bson.ObjectID `json:"zoneId"`
ZoneCode string `json:"zoneCode"`
ZoneName string `json:"zoneName"`
ZoneType stock.ZoneType `json:"zoneType"`
LocationId *bson.ObjectID `json:"locationId"`
LocationCode string `json:"locationCode"`
LocationName string `json:"locationName"`
LocationType stock.LocationType `json:"locationType"`
PrivateSkuID *bson.ObjectID `json:"privateSkuId"`
BatchNo string `json:"batchNo"`
BatchQty int `json:"batchQty"`
AvailableQty int `json:"availableQty"`
BatchStatus stock.BatchStatus `json:"batchStatus"`
OrderID *bson.ObjectID `json:"orderId"`
SupplierID *bson.ObjectID `json:"supplierId"`
SupportsRecycle bool `json:"supportsRecycle"`
ProductionDate *gtime.Time `json:"productionDate"`
ExpiryDate *gtime.Time `json:"expiryDate"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate"`
PrivateCategoryPath string `json:"privateCategoryPath"`
StockStatus stock.StockStatus `json:"stockStatus"`
LastMovedAt *gtime.Time `json:"lastMovedAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// ListPrivateStockReq 获取私域库存列表请求
type ListPrivateStockReq struct {
g.Meta `path:"/listPrivateStocks" method:"get" tags:"私域库存管理" summary:"获取私域库存列表" dc:"分页查询私域库存列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
WarehouseId *bson.ObjectID `json:"warehouseId" dc:"仓库ID"`
ZoneId *bson.ObjectID `json:"zoneId" dc:"库区ID"`
LocationId *bson.ObjectID `json:"locationId" dc:"库位ID"`
PrivateSkuID *bson.ObjectID `json:"privateSkuId" dc:"私域SKU ID"`
BatchStatus *stock.BatchStatus `json:"batchStatus" dc:"批次状态"`
StockStatus *stock.StockStatus `json:"stockStatus" dc:"库存状态"`
SupplierID *bson.ObjectID `json:"supplierId" dc:"供应商ID"`
PrivateCategoryPath string `json:"privateCategoryPath" dc:"私域分类路径"`
StockType stock.StockLocationType `json:"stockType" dc:"库存类型"`
}
// ListPrivateStockRes 获取私域库存列表响应
type ListPrivateStockRes struct {
List []GetPrivateStockRes `json:"list"`
Total int64 `json:"total"`
}
// OutboundPrivateStockReq 实物库存批次出库请求
type OutboundPrivateStockReq struct {
g.Meta `path:"/outboundPrivateStock" method:"post" tags:"实物库存批次管理" summary:"实物库存批次出库" dc:"实物库存批次出库操作"`
StockId *bson.ObjectID `json:"stockId" v:"required" dc:"实物库存批次ID"`
OutboundQty int `json:"outboundQty" v:"required|min:1" dc:"出库数量"`
StockType stock.StockLocationType `json:"stockType" v:"required" dc:"库存类型必须为PrivateStock"`
}

View File

@@ -0,0 +1,90 @@
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"
)
// CommonResp 通用响应
type CommonResp struct {
Success bool `json:"success"` // 是否成功
Message string `json:"message"` // 消息
}
// --- 批次管理API相关结构 ---
// CreateBatchReq 创建批次请求
type CreateBatchReq struct {
g.Meta `path:"/createBatch" method:"post" tags:"库存批次管理" summary:"创建批次" dc:"创建新的库存批次"`
AssetId *bson.ObjectID `json:"assetId" v:"required" dc:"资产ID"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" v:"required" dc:"SKU ID"`
BatchNo string `json:"batchNo" v:"required" dc:"批次号"`
BatchQty int `json:"batchQty" v:"required|min:1" dc:"批次数量"`
AvailableQty int `json:"availableQty" v:"required|min:1" dc:"可用数量"`
Metadata []map[string]interface{} `json:"metadata" dc:"元数据"`
Status stock.BatchStatus `json:"status" dc:"状态"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期(格式:2006-01-02)"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期(格式:2006-01-02)"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间(格式:2006-01-02)"`
}
// CreateBatchRes 创建批次响应
type CreateBatchRes struct {
Id *bson.ObjectID `json:"id"` // 批次ID
}
// UpdateBatchReq 更新批次请求
type UpdateBatchReq struct {
g.Meta `path:"/updateBatch" method:"put" tags:"库存批次管理" summary:"更新批次" dc:"更新批次信息"`
Id *bson.ObjectID `json:"id" v:"required" dc:"批次ID"`
BatchQty int `json:"batchQty" v:"required|min:1" dc:"批次数量"`
AvailableQty int `json:"availableQty" v:"required|min:1" dc:"可用数量"`
}
// DeleteBatchReq 删除批次请求
type DeleteBatchReq struct {
g.Meta `path:"/deleteBatch" method:"delete" tags:"库存批次管理" summary:"删除批次" dc:"删除批次"`
Id *bson.ObjectID `json:"id" v:"required" dc:"批次ID"`
}
// GetBatchReq 获取批次详情请求
type GetBatchReq struct {
g.Meta `path:"/getBatch" method:"get" tags:"库存批次管理" summary:"获取批次详情" dc:"获取批次详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"批次ID"`
}
// GetBatchRes 获取批次详情响应
type GetBatchRes struct {
Id *bson.ObjectID `json:"id"`
AssetId *bson.ObjectID `json:"assetId"`
AssetSkuId *bson.ObjectID `json:"assetSkuId"`
BatchNo string `json:"batchNo"`
BatchQty int `json:"batchQty"`
AvailableQty int `json:"availableQty"`
Metadata []map[string]interface{} `json:"metadata"`
Status stock.BatchStatus `json:"status"`
ProductionDate *gtime.Time `json:"productionDate"`
ExpiryDate *gtime.Time `json:"expiryDate"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate"`
}
// ListBatchReq 获取批次列表请求
type ListBatchReq struct {
g.Meta `path:"/listBatches" method:"get" tags:"库存批次管理" summary:"获取批次列表" dc:"分页查询批次列表"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
AssetId *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" dc:"SKU ID"`
}
// ListBatchRes 获取批次列表响应
type ListBatchRes struct {
List []GetBatchRes `json:"list"`
Total int64 `json:"total"`
}

View File

@@ -0,0 +1,67 @@
package dto
import (
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// GetStockDetailsReq 获取库存明细详情请求
type GetStockDetailsReq struct {
g.Meta `path:"/getStockDetails" method:"get" tags:"库存明细管理" summary:"获取库存明细详情" dc:"获取库存明细详情"`
Id *bson.ObjectID `json:"id" v:"required" dc:"库存明细ID"`
}
// GetStockDetailsRes 获取库存明细详情响应
type GetStockDetailsRes struct {
Id *bson.ObjectID `json:"id"`
AssetId *bson.ObjectID `json:"assetId"`
AssetSkuId *bson.ObjectID `json:"assetSkuId"`
Status stock.StockStatus `json:"status"`
OrderId *bson.ObjectID `json:"orderId"`
LockExpire string `json:"lockExpire"`
Metadata map[string]interface{} `json:"metadata"`
TokenId string `json:"tokenId"`
AssignedChannel string `json:"assignedChannel"`
ChannelSKU string `json:"channelSku"`
AllocatedAt string `json:"allocatedAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// ListStockDetailsReq 获取库存明细列表请求
type ListStockDetailsReq struct {
g.Meta `path:"/listStockDetails" method:"get" tags:"库存明细管理" summary:"获取库存明细列表" dc:"分页查询库存明细列表,支持多条件筛选"`
*beans.Page
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
AssetId *bson.ObjectID `json:"assetId" dc:"资产ID"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" dc:"SKU ID"`
CategoryPath string `json:"categoryPath" dc:"分类路径"`
Status stock.StockStatus `json:"status" dc:"状态"`
}
// ListStockDetailsRes 获取库存明细列表响应
type ListStockDetailsRes struct {
List []*StockDetailsListItem `json:"list" dc:"库存明细列表"`
Total int64 `json:"total" dc:"总数"`
}
// StockDetailsListItem 库存明细列表项
type StockDetailsListItem struct {
Id *bson.ObjectID `json:"id"`
AssetId *bson.ObjectID `json:"assetId"`
AssetSkuId *bson.ObjectID `json:"assetSkuId"`
Status stock.StockStatus `json:"status"`
OrderId *bson.ObjectID `json:"orderId"`
LockExpire string `json:"lockExpire"`
Metadata map[string]interface{} `json:"metadata"`
TokenId *bson.ObjectID `json:"tokenId"`
AssignedChannel string `json:"assignedChannel"`
ChannelSKU string `json:"channelSku"`
AllocatedAt string `json:"allocatedAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}

View File

@@ -0,0 +1,77 @@
package dto
import (
"assets/consts/stock"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
type StockOperationReq struct {
g.Meta `path:"/stockOperation" method:"post" tags:"库存管理" summary:"库存操作(创建/修改)" dc:"库存操作(创建/修改)"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" v:"required" dc:"关联资产SKU ID"`
Stock int `json:"stock" v:"required|min:1" dc:"库存数量"`
// 批次模式专用字段
BatchNo string `json:"batchNo" dc:"批次号(批次模式必填)"`
ProductionDate *gtime.Time `json:"productionDate" dc:"生产日期(批次模式,格式:2006-01-02)"`
ExpiryDate *gtime.Time `json:"expiryDate" dc:"过期日期(批次模式,格式:2006-01-02)"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate" dc:"临期预警时间(格式:2006-01-02)"`
}
// StockPublishMessage 库存发布消息
type StockPublishMessage struct {
AssetId string `json:"assetId"`
AssetSkuId string `json:"assetSkuId"`
TenantId interface{} `json:"tenantId"`
UserName interface{} `json:"userName"`
StockCount int `json:"stockCount"`
OperationType string `json:"operationType"`
Metadata []map[string]interface{} `json:"metadata"`
StockId string `json:"stockId"`
StockMode int `json:"stockMode"`
BatchNo string `json:"batchNo"`
ProductionDate *gtime.Time `json:"productionDate"`
ExpiryDate *gtime.Time `json:"expiryDate"`
ExpiryWarningDate *gtime.Time `json:"expiryWarningDate"`
}
// GetStockFormFieldsReq 获取库存表单字段请求
type GetStockFormFieldsReq struct {
g.Meta `path:"/getStockFormFields" method:"get" tags:"库存管理" summary:"获取库存操作表单字段" dc:"根据资产SKU的库存管理模式动态返回表单字段"`
AssetSkuId *bson.ObjectID `json:"assetSkuId" v:"required" dc:"关联资产ID"`
}
// GetStockFormFieldsRes 获取库存表单字段响应
type GetStockFormFieldsRes struct {
StockMode stock.StockMode `json:"stockMode" dc:"库存管理模式:1-明细模式 2-批次模式"`
Fields []map[string]interface{} `json:"fields" dc:"表单字段列表"`
}
// MoveStockReq 移库请求(库位间移动)
type MoveStockReq struct {
g.Meta `path:"/moveStock" method:"post" tags:"库存管理" summary:"移库" dc:"将库存从一个库位移动到另一个库位(仅支持私域库存)"`
StockType stock.StockLocationType `json:"stockType" v:"required|in:2" dc:"库存类型2-PrivateStock仅支持私域库存"`
StockId *bson.ObjectID `json:"stockId" v:"required" dc:"私域库存ID"`
FromLocationId *bson.ObjectID `json:"fromLocationId" v:"required" dc:"源库位ID"`
ToLocationId *bson.ObjectID `json:"toLocationId" v:"required" dc:"目标库位ID"`
Quantity int `json:"quantity" dc:"移动数量(保留字段,暂未使用)"`
Remark string `json:"remark" dc:"备注"`
}
// TransferStockReq 调拨请求(仓库间调拨)
type TransferStockReq struct {
g.Meta `path:"/transferStock" method:"post" tags:"库存管理" summary:"调拨" dc:"将库存从一个仓库调拨到另一个仓库(仅支持私域库存)"`
StockType stock.StockLocationType `json:"stockType" v:"required|in:2" dc:"库存类型2-PrivateStock仅支持私域库存"`
StockId *bson.ObjectID `json:"stockId" v:"required" dc:"私域库存ID"`
FromWarehouseId *bson.ObjectID `json:"fromWarehouseId" v:"required" dc:"源仓库ID"`
ToWarehouseId *bson.ObjectID `json:"toWarehouseId" v:"required" dc:"目标仓库ID"`
ToZoneId *bson.ObjectID `json:"toZoneId" dc:"目标库区ID可选"`
ToLocationId *bson.ObjectID `json:"toLocationId" dc:"目标库位ID可选"`
Quantity int `json:"quantity" dc:"调拨数量(保留字段,暂未使用)"`
Remark string `json:"remark" dc:"备注"`
}

View File

@@ -0,0 +1 @@
package dto

View File

@@ -0,0 +1 @@
package dto

View File

@@ -0,0 +1,56 @@
package dto
import (
"assets/consts/stock"
entity "assets/model/entity/stock"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// CreateUnitConversionReq 创建单位换算请求
type CreateUnitConversionReq struct {
g.Meta `path:"/createUnitConversion" method:"post" tags:"单位换算" summary:"创建单位换算" dc:"创建新的单位换算规则"`
ConversionCode string `json:"conversionCode" v:"required" dc:"换算编码"`
ConversionName string `json:"conversionName" v:"required" dc:"换算名称"`
UnitType stock.CapacityUnitType `json:"unitType" v:"required" dc:"单位类型"`
FromUnit string `json:"fromUnit" v:"required" dc:"源单位"`
ToUnit string `json:"toUnit" v:"required" dc:"目标单位"`
ConversionFactor float64 `json:"conversionFactor" v:"required|min:0" dc:"换算系数"`
Remark string `json:"remark" dc:"备注"`
}
type CreateUnitConversionRes struct {
Id *bson.ObjectID `json:"id" dc:"换算规则ID"`
}
// UpdateUnitConversionReq 更新单位换算请求
type UpdateUnitConversionReq struct {
g.Meta `path:"/updateUnitConversion" method:"put" tags:"单位换算" summary:"更新单位换算" dc:"更新单位换算规则"`
Id *bson.ObjectID `json:"id" v:"required" dc:"换算规则ID"`
ConversionCode string `json:"conversionCode" dc:"换算编码"`
ConversionName string `json:"conversionName" dc:"换算名称"`
UnitType stock.CapacityUnitType `json:"unitType" dc:"单位类型"`
FromUnit string `json:"fromUnit" dc:"源单位"`
ToUnit string `json:"toUnit" dc:"目标单位"`
ConversionFactor float64 `json:"conversionFactor" v:"min:0" dc:"换算系数"`
Remark string `json:"remark" dc:"备注"`
}
// DeleteUnitConversionReq 删除单位换算请求
type DeleteUnitConversionReq struct {
g.Meta `path:"/deleteUnitConversion" method:"delete" tags:"单位换算" summary:"删除单位换算" dc:"删除单位换算规则"`
Id *bson.ObjectID `json:"id" v:"required" dc:"换算规则ID"`
}
// ListUnitConversionReq 查询单位换算列表请求
type ListUnitConversionReq struct {
g.Meta `path:"/listUnitConversion" method:"get" tags:"单位换算" summary:"查询单位换算列表" dc:"查询单位换算规则列表"`
UnitType *stock.CapacityUnitType `json:"unitType" dc:"过滤单位类型"`
FromUnit string `json:"fromUnit" dc:"过滤源单位"`
ToUnit string `json:"toUnit" dc:"过滤目标单位"`
}
type ListUnitConversionRes struct {
List []entity.UnitConversion `json:"list" dc:"换算规则列表"`
}

View File

@@ -0,0 +1,115 @@
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:"更新时间"`
}

122
model/dto/stock/zone_dto.go Normal file
View File

@@ -0,0 +1,122 @@
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:"更新时间"`
}

View File

@@ -0,0 +1,248 @@
package dto
import (
consts "assets/consts/public"
"go.mongodb.org/mongo-driver/v2/bson"
)
// AssetRequest 通用资产请求结构体
type AssetRequest struct {
ID *bson.ObjectID `json:"id" dc:"资产ID"`
Name string `json:"name" dc:"资产名称"`
CategoryID *bson.ObjectID `json:"categoryId" dc:"分类ID"`
ImageURL string `json:"imageUrl" dc:"主图URL"`
Images interface{} `json:"images" dc:"图片列表"`
Description string `json:"description" dc:"描述"`
BasePrice float64 `json:"basePrice" dc:"基础价格"`
SalePrice float64 `json:"salePrice" dc:"销售价格"`
BrandID string `json:"brandId" dc:"品牌ID"`
Status string `json:"status" dc:"状态"`
}
// AssetResponse 通用资产响应结构体
type AssetResponse struct {
ID *bson.ObjectID `json:"id" dc:"资产ID"`
Name string `json:"name" dc:"资产名称"`
CategoryID *bson.ObjectID `json:"categoryId" dc:"分类ID"`
ImageURL string `json:"imageUrl" dc:"主图URL"`
Images interface{} `json:"images" dc:"图片列表"`
Description string `json:"description" dc:"描述"`
BasePrice float64 `json:"basePrice" dc:"基础价格"`
SalePrice float64 `json:"salePrice" dc:"销售价格"`
Platform string `json:"platform" dc:"平台"`
}
// APIResponse 通用API响应结构体
type APIResponse struct {
Success bool `json:"success" dc:"是否成功"`
ErrorCode int64 `json:"error_code,omitempty" dc:"错误码"`
ErrorMsg string `json:"error_msg,omitempty" dc:"错误信息"`
Data interface{} `json:"data,omitempty" dc:"响应数据"`
}
// PlatformMapping 平台映射结构体
type PlatformMapping struct {
AssetID string `json:"asset_id" dc:"资产ID"`
PlatformID string `json:"platform_id" dc:"平台ID"`
ExternalID string `json:"external_id" dc:"外部ID"`
PlatformType string `json:"platform_type" dc:"平台类型"`
}
// KuaishouAssetRequest 快手资产请求结构体
type KuaishouAssetRequest struct {
Title string `json:"title" dc:"商品标题"`
CategoryID int64 `json:"category_id" dc:"分类ID"`
MainImage string `json:"main_image" dc:"主图"`
Images interface{} `json:"images" dc:"图片列表"`
Description string `json:"description" dc:"描述"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
Price float64 `json:"price" dc:"价格"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
ExternalID string `json:"external_id" dc:"外部ID"`
}
// KuaishouAssetResponse 快手资产响应结构体
type KuaishouAssetResponse struct {
ItemID string `json:"item_id" dc:"商品ID"`
Title string `json:"title" dc:"商品标题"`
CategoryID int64 `json:"category_id" dc:"分类ID"`
MainImage string `json:"main_image" dc:"主图"`
Price float64 `json:"price" dc:"价格"`
ExternalID string `json:"external_id" dc:"外部ID"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// KuaishouSkuRequest 快手SKU请求结构体
type KuaishouSkuRequest struct {
SkuName string `json:"sku_name" dc:"SKU名称"`
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
Price float64 `json:"price" dc:"价格"`
StockNum int64 `json:"stock_num" dc:"库存数量"`
Specs interface{} `json:"specs" dc:"规格参数"`
Status int `json:"status" dc:"状态"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// KuaishouStockRequest 快手库存请求结构体
type KuaishouStockRequest struct {
SkuID string `json:"sku_id" dc:"SKU ID"`
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
StockNum int64 `json:"stock_num" dc:"库存数量"`
LockStockNum int64 `json:"lock_stock_num" dc:"锁定库存"`
InTransitNum int64 `json:"in_transit_num" dc:"在途数量"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// DouyinAssetRequest 抖音资产请求结构体
type DouyinAssetRequest struct {
Goods struct {
ProductName string `json:"product_name" dc:"商品名称"`
SecCategoryID int64 `json:"sec_category_id" dc:"二级分类ID"`
MainImg string `json:"main_img" dc:"主图"`
Imgs interface{} `json:"imgs" dc:"图片列表"`
DetailHTML string `json:"detail_html" dc:"详情HTML"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
DiscountPrice float64 `json:"discount_price" dc:"折扣价"`
MobileDetail string `json:"mobile_detail" dc:"移动端详情"`
PayType int `json:"pay_type" dc:"支付类型"`
DeliveryInfo interface{} `json:"delivery_info" dc:"配送信息"`
} `json:"goods" dc:"商品信息"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
ExternalID string `json:"external_id" dc:"外部ID"`
}
// DouyinAssetResponse 抖音资产响应结构体
type DouyinAssetResponse struct {
GoodsID string `json:"goods_id" dc:"商品ID"`
ProductName string `json:"product_name" dc:"商品名称"`
SecCategoryID int64 `json:"sec_category_id" dc:"二级分类ID"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
DiscountPrice float64 `json:"discount_price" dc:"折扣价"`
ExternalID string `json:"external_id" dc:"外部ID"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// DouyinSkuRequest 抖音SKU请求结构体
type DouyinSkuRequest struct {
SkuName string `json:"sku_name" dc:"SKU名称"`
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
Price float64 `json:"price" dc:"价格"`
StockNum int64 `json:"stock_num" dc:"库存数量"`
Specs interface{} `json:"specs" dc:"规格参数"`
Status int `json:"status" dc:"状态"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// DouyinStockRequest 抖音库存请求结构体
type DouyinStockRequest struct {
SkuID string `json:"sku_id" dc:"SKU ID"`
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
StockNum int64 `json:"stock_num" dc:"库存数量"`
LockStockNum int64 `json:"lock_stock_num" dc:"锁定库存"`
InTransitNum int64 `json:"in_transit_num" dc:"在途数量"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// JDAssetRequest 京东资产请求结构体
type JDAssetRequest struct {
Product struct {
Name string `json:"name" dc:"商品名称"`
CategoryID string `json:"category_id" dc:"分类ID"`
BrandID string `json:"brand_id" dc:"品牌ID"`
MainImage string `json:"main_image" dc:"主图"`
Images interface{} `json:"images" dc:"图片列表"`
Description string `json:"description" dc:"描述"`
Specifications interface{} `json:"specifications" dc:"规格参数"`
Logistics interface{} `json:"logistics" dc:"物流信息"`
AfterSales interface{} `json:"after_sales" dc:"售后信息"`
SupplyPrice float64 `json:"supply_price" dc:"供货价"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
Status string `json:"status" dc:"状态"`
} `json:"product" dc:"商品信息"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
ExternalID string `json:"external_id" dc:"外部ID"`
}
// JDAssetResponse 京东资产响应结构体
type JDAssetResponse struct {
SkuID string `json:"sku_id" dc:"SKU ID"`
WareID string `json:"ware_id" dc:"商品ID"`
ProductName string `json:"product_name" dc:"商品名称"`
CategoryID string `json:"category_id" dc:"分类ID"`
SupplyPrice float64 `json:"supply_price" dc:"供货价"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
ExternalID string `json:"external_id" dc:"外部ID"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// JDSkuRequest 京东SKU请求结构体
type JDSkuRequest struct {
SkuName string `json:"sku_name" dc:"SKU名称"`
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
Price float64 `json:"price" dc:"价格"`
StockNum int64 `json:"stock_num" dc:"库存数量"`
Specification string `json:"specification" dc:"规格"`
Status string `json:"status" dc:"状态"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// JDStockRequest 京东库存请求结构体
type JDStockRequest struct {
SkuID string `json:"sku_id" dc:"SKU ID"`
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
Quantity int64 `json:"quantity" dc:"库存数量"`
LockQuantity int64 `json:"lock_quantity" dc:"锁定库存"`
InTransit int64 `json:"in_transit" dc:"在途数量"`
Location string `json:"location" dc:"仓库位置"`
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
}
// PinduoduoAssetRequest 拼多多资产请求结构体
type PinduoduoAssetRequest struct {
GoodsID string `json:"goods_id" dc:"商品ID"`
GoodsName string `json:"goods_name" dc:"商品名称"`
GoodsDesc string `json:"goods_desc" dc:"商品描述"`
CatID string `json:"cat_id" dc:"分类ID"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
GoodsImageURL string `json:"goods_image_url" dc:"商品主图"`
GoodsGalleryURLs interface{} `json:"goods_gallery_urls" dc:"商品轮播图"`
}
// PinduoduoAssetResponse 拼多多资产响应结构体
type PinduoduoAssetResponse struct {
GoodsID string `json:"goods_id" dc:"商品ID"`
GoodsName string `json:"goods_name" dc:"商品名称"`
GoodsDesc string `json:"goods_desc" dc:"商品描述"`
CatID string `json:"cat_id" dc:"分类ID"`
MarketPrice float64 `json:"market_price" dc:"市场价"`
GoodsImageURL string `json:"goods_image_url" dc:"商品主图"`
}
// SkuRequest 通用SKU请求结构体
type SkuRequest struct {
ID string `json:"id" dc:"SKU ID"`
SkuCode string `json:"skuCode" dc:"SKU编码"`
Price float64 `json:"price" dc:"价格"`
Stock int64 `json:"stock" dc:"库存"`
Specification interface{} `json:"specification" dc:"规格"`
}
// StockRequest 通用库存请求结构体
type StockRequest struct {
ID string `json:"id" dc:"库存ID"`
AssetSkuID string `json:"assetSkuId" dc:"资产SKU ID"`
AvailableQty int64 `json:"availableQty" dc:"可用数量"`
LockedQty int64 `json:"lockedQty" dc:"锁定数量"`
InTransitQty int64 `json:"inTransitQty" dc:"在途数量"`
Location string `json:"location" dc:"位置"`
}
// SyncResult 同步结果结构体
type SyncResult struct {
Success bool `json:"success" dc:"是否成功"`
Message string `json:"message" dc:"消息"`
Data interface{} `json:"data" dc:"数据"`
Platform consts.SyncPlatform `json:"platform" dc:"平台"`
ExternalID string `json:"external_id,omitempty" dc:"外部ID"`
}

142
model/dto/sync/sync_dto.go Normal file
View File

@@ -0,0 +1,142 @@
package dto
import (
consts "assets/consts/public"
"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"
)
// CreateSyncTaskReq 创建同步任务请求
type CreateSyncTaskReq struct {
g.Meta `path:"/createSyncTask" method:"post" tags:"同步任务" summary:"创建同步任务" dc:"创建新的同步任务"`
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
SyncType consts.SyncType `json:"syncType" v:"required" dc:"同步类型full全量/incremental增量"`
AssetID *bson.ObjectID `json:"assetId,omitempty" dc:"资产ID"`
AssetSKUID *bson.ObjectID `json:"assetSkuId,omitempty" dc:"资产SKU ID"`
StockID *bson.ObjectID `json:"stockId,omitempty" dc:"库存ID"`
}
// CreateSyncTaskRes 创建同步任务响应
type CreateSyncTaskRes struct {
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
}
// ListSyncTaskReq 同步任务列表请求
type ListSyncTaskReq struct {
g.Meta `path:"/listSyncTasks" method:"get" tags:"同步任务" summary:"获取同步任务列表" dc:"分页查询同步任务列表,支持多条件筛选"`
beans.Page
Platform consts.SyncPlatform `json:"platform,omitempty" dc:"同步平台"`
Status consts.SyncStatus `json:"status,omitempty" dc:"同步状态"`
StartTime *gtime.Time `json:"startTime,omitempty" dc:"开始时间"`
EndTime *gtime.Time `json:"endTime,omitempty" dc:"结束时间"`
}
// ListSyncTaskRes 同步任务列表响应
type ListSyncTaskRes struct {
List []*SyncTaskItem `json:"list" dc:"同步任务列表"`
Total int64 `json:"total" dc:"总数"`
}
// SyncTaskItem 同步任务项
type SyncTaskItem struct {
ID *bson.ObjectID `json:"id" dc:"任务ID"`
Platform consts.SyncPlatform `json:"platform" dc:"同步平台"`
SyncType consts.SyncType `json:"syncType" dc:"同步类型"`
Status consts.SyncStatus `json:"status" dc:"同步状态"`
AssetID *bson.ObjectID `json:"assetId,omitempty" dc:"资产ID"`
AssetSKUID *bson.ObjectID `json:"assetSkuId,omitempty" dc:"资产SKU ID"`
StockID *bson.ObjectID `json:"stockId,omitempty" dc:"库存ID"`
ErrorMessage string `json:"errorMessage,omitempty" dc:"错误信息"`
ErrorCount int `json:"errorCount" dc:"错误次数"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
StartedAt *gtime.Time `json:"startedAt,omitempty" dc:"开始时间"`
FinishedAt *gtime.Time `json:"finishedAt,omitempty" dc:"完成时间"`
}
// GetSyncTaskReq 获取同步任务详情请求
type GetSyncTaskReq struct {
g.Meta `path:"/getSyncTask" method:"get" tags:"同步任务" summary:"获取同步任务详情" dc:"获取同步任务详情"`
ID *bson.ObjectID `json:"id" v:"required" dc:"任务ID"`
}
// GetSyncTaskRes 获取同步任务详情响应
type GetSyncTaskRes struct {
SyncTaskItem
}
// UpdateSyncTaskStatusReq 更新同步任务状态请求
type UpdateSyncTaskStatusReq struct {
g.Meta `path:"/updateSyncTaskStatus" method:"put" tags:"同步任务" summary:"更新同步任务状态" dc:"更新同步任务状态"`
ID *bson.ObjectID `json:"id" v:"required" dc:"任务ID"`
Status consts.SyncStatus `json:"status" v:"required" dc:"同步状态"`
ErrorMessage string `json:"errorMessage,omitempty" dc:"错误信息"`
}
// SyncAssetReq 同步资产请求
type SyncAssetReq struct {
g.Meta `path:"/syncAsset" method:"post" tags:"资产同步" summary:"同步资产" dc:"同步资产到指定平台"`
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
AssetID *bson.ObjectID `json:"assetId" v:"required" dc:"资产ID"`
}
// SyncAssetRes 同步资产响应
type SyncAssetRes struct {
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
}
// SyncAssetSkuReq 同步资产SKU请求
type SyncAssetSkuReq struct {
g.Meta `path:"/syncAssetSku" method:"post" tags:"SKU同步" summary:"同步资产SKU" dc:"同步资产SKU到指定平台"`
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
AssetSKUID *bson.ObjectID `json:"assetSkuId" v:"required" dc:"资产SKU ID"`
}
// SyncAssetSkuRes 同步资产SKU响应
type SyncAssetSkuRes struct {
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
}
// SyncStockReq 同步库存请求
type SyncStockReq struct {
g.Meta `path:"/syncStock" method:"post" tags:"库存同步" summary:"同步库存" dc:"同步库存到指定平台"`
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
StockID *bson.ObjectID `json:"stockId" v:"required" dc:"库存ID"`
}
// SyncStockRes 同步库存响应
type SyncStockRes struct {
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
}
// BatchSyncAssetsReq 批量同步资产请求
type BatchSyncAssetsReq struct {
g.Meta `path:"/batchSyncAssets" method:"post" tags:"批量同步" summary:"批量同步资产" dc:"批量同步资产到指定平台"`
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
AssetIDs []*bson.ObjectID `json:"assetIds" v:"required" dc:"资产ID列表"`
}
// BatchSyncAssetsRes 批量同步资产响应
type BatchSyncAssetsRes struct {
TaskIDs []*bson.ObjectID `json:"taskIds" dc:"任务ID列表"`
}
// GetPlatformSyncStatusReq 获取平台同步状态请求
type GetPlatformSyncStatusReq struct {
g.Meta `path:"/getPlatformSyncStatus" method:"get" tags:"平台状态" summary:"获取平台同步状态" dc:"获取指定平台的同步状态"`
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
}
// GetPlatformSyncStatusRes 获取平台同步状态响应
type GetPlatformSyncStatusRes struct {
Platform consts.SyncPlatform `json:"platform" dc:"同步平台"`
IsEnabled bool `json:"isEnabled" dc:"是否启用"`
LastSyncTime *gtime.Time `json:"lastSyncTime,omitempty" dc:"最后同步时间"`
NextSyncTime *gtime.Time `json:"nextSyncTime,omitempty" dc:"下次同步时间"`
SyncCount int64 `json:"syncCount" dc:"同步次数"`
SuccessCount int64 `json:"successCount" dc:"成功次数"`
FailedCount int64 `json:"failedCount" dc:"失败次数"`
}

View File

@@ -0,0 +1,43 @@
package entity
import (
consts "assets/consts/asset"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
)
// Asset 资产实体
type Asset struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, IsDeleted
// 基础信息
Name string `orm:"name" json:"name" description:"资产名称"`
Description string `orm:"description" json:"description" description:"资产描述"`
Type consts.AssetType `orm:"type" json:"type" description:"资产类型physical实物/virtual虚拟/service服务"`
CategoryId uint64 `orm:"category_id" json:"categoryId" description:"分类ID"`
CategoryPath string `orm:"category_path" json:"categoryPath" description:"分类路径"`
ImageURL string `orm:"image_url" json:"imageUrl" description:"主图URL"`
Images []string `orm:"images" json:"images" description:"图片列表(JSONB)"`
Status *consts.AssetStatus `orm:"status" json:"status" description:"资产状态1启用/0停用"`
BasePrice int `orm:"base_price" json:"basePrice" description:"基础价格(分为单位)"`
Currency string `orm:"currency" json:"currency" description:"货币单位默认CNY"`
UnlimitedStock bool `orm:"unlimited_stock" json:"unlimitedStock" description:"是否无库存限制"`
StockMode stock.StockMode `orm:"stock_mode" json:"stockMode" description:"库存管理模式1-明细模式 2-批次模式"`
// 上线和下线时间配置(由定时任务处理资产状态)
OnlineTime *gtime.Time `orm:"online_time" json:"onlineTime,omitempty" description:"上线时间"`
OfflineTime *gtime.Time `orm:"offline_time" json:"offlineTime,omitempty" description:"下线时间"`
// 类型专用配置 - 实物资产配置(JSONB)
PhysicalAssetConfig *gjson.Json `orm:"physical_asset_config" json:"physicalAssetConfig" description:"实物资产配置(JSONB)"`
// 类型专用配置 - 服务资产配置(JSONB)
ServiceAssetConfig *gjson.Json `orm:"service_asset_config" json:"serviceAssetConfig" description:"服务资产配置(JSONB)"`
// 类型专用配置 - 虚拟资产配置(JSONB)
VirtualAssetConfig *gjson.Json `orm:"virtual_asset_config" json:"virtualAssetConfig" description:"虚拟资产配置(JSONB)"`
// 扩展字段(JSONB)
Metadata *gjson.Json `orm:"metadata" json:"metadata" description:"动态元数据(JSONB)"`
TenantModuleType string `orm:"tenant_module_type" json:"tenantModuleType" description:"租户模块类型"`
}

View File

@@ -0,0 +1,44 @@
package entity
import (
consts "assets/consts/asset"
"assets/consts/public"
"assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
"go.mongodb.org/mongo-driver/v2/bson"
)
// AssetSku 资产SKU实体
type AssetSku struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
AssetName string `bson:"assetName" json:"assetName"` // 资产名称
SkuName string `bson:"skuName" json:"skuName"` // SKU名称
ImageURL string `bson:"imageUrl,omitempty" json:"imageUrl"` // SKU主图
SpecValues []map[string]interface{} `bson:"specValues" json:"specValues"` // 规格值:{"颜色":"红色","尺寸":"L","时长":"1个月","平台":"抖音"}
Price int `bson:"price" json:"price"` // 价格(分为单位)
UnlimitedStock bool `bson:"unlimitedStock" json:"unlimitedStock"` // 是否无库存限制
Stock int `bson:"stock" json:"stock"` // 库存数量
SpecsCount int `bson:"specsCount" json:"specsCount"` // 规格数量
SpecsUnit *SpecsUnitKeyValue `bson:"specsUnit" json:"specsUnit"` // 规格单位
Sort int `bson:"sort" json:"sort"` // 排序
Status *consts.AssetSkuStatus `bson:"status" json:"status"` // 状态active/inactive/disabled
StockMode stock.StockMode `bson:"stockMode" json:"stockMode"` // 库存管理模式1-明细模式 2-批次模式
CategoryId *bson.ObjectID `bson:"categoryId" json:"categoryId"` // 分类ID
CategoryPath string `bson:"categoryPath" json:"categoryPath"` // 分类路径
CapacityUnitType stock.CapacityUnitType `bson:"capacityUnitType" json:"capacityUnitType"` // 容量单位类型
Capacity config.Capacity `bson:"capacity" json:"capacity"` //容量
TenantModuleType beans.TenantModuleType `bson:"tenantModuleType" json:"tenantModuleType"`
}
type SpecsUnitKeyValue struct {
Key string `bson:"key" json:"key"` // 对应原有常量值
Value string `bson:"value" json:"value"` // 对应描述信息
}
// CollectionName 获取集合名称
func (AssetSku) CollectionName() string {
return public.AssetSkuCollection
}

View File

@@ -0,0 +1,74 @@
package entity
import (
consts "assets/consts/category"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/encoding/gjson"
)
type categoryCol struct {
beans.SQLBaseCol
Name string
ParentId string
Path string
Level string
IsLeafNode string
Sort string
Image string
Attrs string
Status string
}
var CategoryCol = categoryCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
ParentId: "parent_id",
Path: "path",
Level: "level",
IsLeafNode: "isLeaf_node",
Sort: "sort",
Image: "image",
Attrs: "attrs",
Status: "status",
}
// Category 分类实体
type Category struct {
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, IsDeleted
Name string `orm:"name" json:"name"` // 分类名称
ParentId string `orm:"parent_id" json:"parentId"` // 父分类ID为空表示根分类
Path string `orm:"path" json:"path"` // 分类路径,如:/root/parent/child
Level int `orm:"level" json:"level"` // 分类层级
IsLeafNode bool `orm:"isLeaf_node" json:"isLeafNode"` // 是叶子节点
Sort int `orm:"sort" json:"sort"` // 排序
Image string `orm:"image" json:"image"` // 分类图片
Attrs []gjson.Json `orm:"attrs" json:"attrs,omitempty"` // 分类属性
// 使用场景说明:
// 1. 商品分类属性:为该分类下的商品定义标准化的属性模板,如服装分类可定义尺寸、颜色、材质等属性
// 2. 服务分类属性:为服务类目定义特性参数,如咨询服务可定义服务时长、服务方式、专业领域等
// 3. 商品发布约束:当商品归属于某个分类时,必须填写该分类定义的必填属性
// 4. 搜索筛选:基于分类属性进行商品筛选和搜索,提升用户体验
// 5. 数据标准化:确保同一分类下的商品具有统一的属性结构,便于数据管理
// 支持的属性类型:文本(text)、数字(number)、日期(date)、单选(select)、多选(multi_select)、布尔(boolean)、图片(image)
Status consts.CategoryStatusType `orm:"status" json:"status"` // 状态1启用/0禁用
}
// CategoryAttr 分类属性
// 用于定义分类下商品或服务的标准化属性模板,确保同类商品属性统一
type CategoryAttr struct {
Name string `json:"name"` // 属性名称,如:尺寸、颜色、品牌等
Type string `json:"type"` // 属性类型text文本/number数字/date日期/select选择/multi_select多选/boolean布尔/image图片
DictType string `json:"dictType"` // 字典类型如果是select/multi_select类型时有效
Required bool `json:"required"` // 是否必填true表示商品发布时必须填写此属性
Options []FieldOption `json:"options"` // 选项配置JSON字符串格式用于select/multi_select类型的可选值列表
// 示例:'{"options":[{"label":"红色","value":"red"},{"label":"蓝色","value":"blue"}]}'
Description string `json:"description"` // 属性描述,向用户说明此属性的具体含义和填写要求
Sort int `json:"sort"` // 排序权重,数值越小排序越靠前,用于属性在界面的显示顺序
}
// FieldOption 字段选项
type FieldOption struct {
Label string `json:"label" dc:"选项标签"`
Value interface{} `json:"value" dc:"选项值"`
}

View File

@@ -0,0 +1,25 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
)
// PrivateCategory 私域分类实体
type PrivateCategory struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
Name string `bson:"name" json:"name"` // 分类名称
ParentID string `bson:"parentId" json:"parentId"` // 父分类ID为空表示根分类
Path string `bson:"path" json:"path"` // 分类路径,如:/root/parent
Level int `bson:"level" json:"level"` // 分类层级
IsLeafNode bool `bson:"isLeafNode" json:"isLeafNode"` // 是叶子节点
Sort int `bson:"sort" json:"sort"` // 排序
Image string `bson:"image" json:"image"` // 分类图片
}
// CollectionName 分类集合名称
func (PrivateCategory) CollectionName() string {
return public.PrivateCategoryCollection
}

View File

@@ -0,0 +1,27 @@
package entity
import (
"assets/consts/public"
consts "assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
)
// PrivateSku 私域资产SKU实体
type PrivateSku struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
SkuName string `bson:"skuName" json:"skuName"` // SKU名称
ImageURL string `bson:"imageUrl,omitempty" json:"imageUrl"` // SKU主图
Price int `bson:"price" json:"price"` // 价格(分为单位)
Stock int `bson:"stock" json:"stock"` // 库存数量
Sort int `bson:"sort" json:"sort"` // 排序
CapacityUnitType consts.CapacityUnitType `bson:"capacityUnitType" json:"capacityUnitType"` // 容量单位类型
Capacity config.Capacity `bson:"capacity" json:"capacity"` //容量
PrivateCategoryPath string `bson:"privateCategoryPath" json:"privateCategoryPath"` // 私域分类路径
}
// CollectionName 获取集合名称
func (PrivateSku) CollectionName() string {
return public.PrivateSkuCollection
}

View File

@@ -0,0 +1,46 @@
package entity
import (
consts "assets/consts/procurement"
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PurchaseBid 采购投标记录(供应商参与竞价订单的记录)
type PurchaseBid struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息(核心关联:直接关联到采购订单)
OrderId *bson.ObjectID `bson:"orderId" json:"orderId"` // 采购订单ID必填直接关联
OrderNo string `bson:"orderNo" json:"orderNo"` // 订单编号(冗余存储,便于查询)
// 投标供应商信息
SupplierId *bson.ObjectID `bson:"supplierId" json:"supplierId"` // 供应商ID
SupplierName string `bson:"supplierName" json:"supplierName"` // 供应商名称
SupplierCode string `bson:"supplierCode" json:"supplierCode"` // 供应商编码
// 投标报价信息(核心业务数据)
TotalBidPrice int `bson:"totalBidPrice" json:"totalBidPrice"` // 总投标价格(分)
UnitPrices map[string]int `bson:"unitPrices" json:"unitPrices"` // 各商品单价 {itemId: price}
DeliveryDays int `bson:"deliveryDays" json:"deliveryDays"` // 承诺交付天数
QualityScore float64 `bson:"qualityScore" json:"qualityScore"` // 质量评分0-100
ServiceScore float64 `bson:"serviceScore" json:"serviceScore"` // 服务评分0-100
// 投标文件
BidRemark string `bson:"bidRemark" json:"bidRemark"` // 投标说明
AttachmentUrls []string `bson:"attachmentUrls" json:"attachmentUrls"` // 附件URL列表
// 状态信息单一状态源IsWinner和BidRank通过Status推断
Status consts.BidStatus `bson:"status" json:"status"` // 投标状态draft/submitted/viewed/winning/lost/withdrawn/expired
// 时间戳(仅保留有意义的业务时间)
BidAt *gtime.Time `bson:"bidAt" json:"bidAt"` // 投标时间(核心业务时间)
}
// CollectionName 获取集合名称
func (PurchaseBid) CollectionName() string {
return public.PurchaseBidCollection
}

View File

@@ -0,0 +1,47 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PurchaseInbound 采购入库记录实体
type PurchaseInbound struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息
OrderId *bson.ObjectID `bson:"orderId" json:"orderId"` // 采购订单ID
OrderItemId *bson.ObjectID `bson:"orderItemId" json:"orderItemId"` // 采购订单明细ID
// 入库数量和时间
InboundQty int `bson:"inboundQty" json:"inboundQty"` // 本次入库数量
InboundDate *gtime.Time `bson:"inboundDate" json:"inboundDate"` // 入库日期
// 仓储信息(非必填)
WarehouseId *bson.ObjectID `bson:"warehouseId,omitempty" json:"warehouseId,omitempty"` // 仓库ID
WarehouseName string `bson:"warehouseName" json:"warehouseName"` // 仓库名称
ZoneId *bson.ObjectID `bson:"zoneId,omitempty" json:"zoneId,omitempty"` // 库区ID
ZoneName string `bson:"zoneName" json:"zoneName"` // 库区名称
LocationId *bson.ObjectID `bson:"locationId,omitempty" json:"locationId,omitempty"` // 库位ID
LocationName string `bson:"locationName" json:"locationName"` // 库位名称
// 私域SKU和分类
PrivateSkuId *bson.ObjectID `bson:"privateSkuId" json:"privateSkuId"` // 私域SKU ID
PrivateSkuName string `bson:"privateSkuName" json:"privateSkuName"` // 私域SKU名称
PrivateCategoryId *bson.ObjectID `bson:"privateCategoryId" json:"privateCategoryId"` // 私域分类ID
PrivateCategoryPath string `bson:"privateCategoryPath" json:"privateCategoryPath"` // 私域分类路径
// 生成的批次信息
BatchNo string `bson:"batchNo" json:"batchNo"` // 生成的批次号
PrivateStockId *bson.ObjectID `bson:"privateStockId" json:"privateStockId"` // 关联的私域库存ID
InboundNo string `bson:"inboundNo" json:"inboundNo"` // 入库单号(自动生成)
Remark string `bson:"remark" json:"remark"` // 入库备注
}
// CollectionName 获取集合名称
func (PurchaseInbound) CollectionName() string {
return public.PurchaseInboundCollection
}

View File

@@ -0,0 +1,91 @@
package entity
import (
consts "assets/consts/procurement"
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// ============================================
// 内嵌结构体定义
// ============================================
// DirectPurchaseInfo 指定供应商模式信息
type DirectPurchaseInfo struct {
// 指定供应商信息
SupplierId *bson.ObjectID `bson:"supplierId" json:"supplierId"` // 指定供应商ID
SupplierName string `bson:"supplierName" json:"supplierName"` // 指定供应商名称
SupplierCode string `bson:"supplierCode" json:"supplierCode"` // 供应商编码
AssignReason string `bson:"assignReason" json:"assignReason"` // 指派原因
DeliveryAddress string `bson:"deliveryAddress" json:"deliveryAddress"` // 交付地址
ContactPerson string `bson:"contactPerson" json:"contactPerson"` // 联系人
ContactPhone string `bson:"contactPhone" json:"contactPhone"` // 联系电话
ResponseStatus string `bson:"responseStatus" json:"responseStatus"` // 供应商响应状态
// 时间戳
AssignedAt *gtime.Time `bson:"assignedAt" json:"assignedAt"` // 指派时间
AcceptedAt *gtime.Time `bson:"acceptedAt" json:"acceptedAt"` // 接受时间
RejectedAt *gtime.Time `bson:"rejectedAt" json:"rejectedAt"` // 拒绝时间
DeliveredAt *gtime.Time `bson:"deliveredAt" json:"deliveredAt"` // 交付时间
}
// BiddingInfo 竞价模式信息
type BiddingInfo struct {
// 竞价设置
BidMode consts.BidMode `bson:"bidMode" json:"bidMode"` // 竞价模式price/quality/time/mixed
MinSuppliers int `bson:"minSuppliers" json:"minSuppliers"` // 最少参与供应商数
MaxSuppliers int `bson:"maxSuppliers" json:"maxSuppliers"` // 最多参与供应商数
BidDuration int `bson:"bidDuration" json:"bidDuration"` // 竞价持续时长(分钟)
BidSupplierCount int `bson:"bidSupplierCount" json:"bidSupplierCount"` // 参与竞价的供应商数量
// 时间戳
BidStartAt *gtime.Time `bson:"bidStartAt" json:"bidStartAt"` // 竞价开始时间
BidEndAt *gtime.Time `bson:"bidEndAt" json:"bidEndAt"` // 竞价结束时间
ResultPublishedAt *gtime.Time `bson:"resultPublishedAt" json:"resultPublishedAt"` // 结果发布时间
}
// ============================================
// 主实体定义
// ============================================
// PurchaseOrder 采购订单实体(统一模式,结构化设计)
type PurchaseOrder struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// ============================================
// 基础订单信息(所有模式共用)
// ============================================
OrderNo string `bson:"orderNo" json:"orderNo"` // 订单编号
Title string `bson:"title" json:"title"` // 订单标题
Description string `bson:"description" json:"description"` // 订单描述
OrderType consts.PurchaseOrderType `bson:"orderType" json:"orderType"` // 订单类型direct/assignment/bidding
// 需求方信息
BuyerId *bson.ObjectID `bson:"buyerId" json:"buyerId"` // 采购方ID经销商/门店)
BuyerName string `bson:"buyerName" json:"buyerName"` // 采购方名称
BuyerType string `bson:"buyerType" json:"buyerType"` // 采购方类型
// 通用状态信息
Status consts.PurchaseOrderStatus `bson:"status" json:"status"` // 订单状态
Priority int `bson:"priority" json:"priority"` // 优先级
// ============================================
// 模式特定信息(内嵌结构体)
// ============================================
DirectPurchase *DirectPurchaseInfo `bson:"directPurchase,omitempty" json:"directPurchase,omitempty"` // 指定供应商模式信息
BiddingInfo *BiddingInfo `bson:"biddingInfo,omitempty" json:"biddingInfo,omitempty"` // 竞价模式信息
// ============================================
// 通用字段
// ============================================
ExpectedDelivery *gtime.Time `bson:"expectedDelivery" json:"expectedDelivery"` // 期望交付时间
ExpiryTime *gtime.Time `bson:"expiryTime" json:"expiryTime"` // 订单有效期/竞价结束时间
}
// CollectionName 获取集合名称
func (PurchaseOrder) CollectionName() string {
return public.PurchaseOrderCollection
}

View File

@@ -0,0 +1,42 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PurchaseOrderItem 采购订单明细实体
type PurchaseOrderItem struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息
OrderId *bson.ObjectID `bson:"orderId" json:"orderId"` // 订单ID
AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 资产ID
AssetSkuId *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 资产SKU ID
// 商品信息
ProductName string `bson:"productName" json:"productName"` // 商品名称
Specification string `bson:"specification" json:"specification"` // 规格描述
Brand string `bson:"brand" json:"brand"` // 品牌
// 数量和价格
Quantity int `bson:"quantity" json:"quantity"` // 订购数量
Unit string `bson:"unit" json:"unit"` // 单位
UnitPrice int `bson:"unitPrice" json:"unitPrice"` // 单价(分)
TotalPrice int `bson:"totalPrice" json:"totalPrice"` // 总价(分)
DiscountPrice int `bson:"discountPrice" json:"discountPrice"` // 折扣价(分)
// 签收和入库
PassQuantity int `bson:"passQuantity" json:"passQuantity"` // 签收数量(与订购数量有差异时应生成退换单)
InboundQty int `bson:"inboundQty" json:"inboundQty"` // 已入库累计数量
// 要求信息
RequirementDesc string `bson:"requirementDesc" json:"requirementDesc"` // 特殊要求描述
DeliveryAddress string `bson:"deliveryAddress" json:"deliveryAddress"` // 交付地址
}
// CollectionName 获取集合名称
func (PurchaseOrderItem) CollectionName() string {
return public.PurchaseOrderItemCollection
}

View File

@@ -0,0 +1,74 @@
package entity
import (
consts "assets/consts/procurement"
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PurchaseReturn 采购退换单主表实体
type PurchaseReturn struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 退换单基本信息
ReturnNo string `bson:"returnNo" json:"returnNo"` // 退换单编号
Title string `bson:"title" json:"title"` // 退换单标题
Description string `bson:"description" json:"description"` // 退换说明
ReturnType consts.ReturnType `bson:"returnType" json:"returnType"` // 退换类型return退货/refund退款/exchange换货
// 关联订单信息
OrderId *bson.ObjectID `bson:"orderId" json:"orderId"` // 关联采购订单ID
OrderNo string `bson:"orderNo" json:"orderNo"` // 关联采购订单编号
AssignmentId *bson.ObjectID `bson:"assignmentId" json:"assignmentId"` // 关联指派单ID如果有
BiddingId *bson.ObjectID `bson:"biddingId" json:"biddingId"` // 关联竞价单ID如果有
// 供应商信息
SupplierId *bson.ObjectID `bson:"supplierId" json:"supplierId"` // 供应商ID
SupplierName string `bson:"supplierName" json:"supplierName"` // 供应商名称
SupplierCode string `bson:"supplierCode" json:"supplierCode"` // 供应商编码
// 退换货物信息
TotalItems int `bson:"totalItems" json:"totalItems"` // 退换商品种类数
TotalQuantity int `bson:"totalQuantity" json:"totalQuantity"` // 退换商品总数量
TotalAmount int `bson:"totalAmount" json:"totalAmount"` // 退换总金额(分)
RefundAmount int `bson:"refundAmount" json:"refundAmount"` // 实际退款金额(分)
// 状态和流程信息
Status consts.ReturnStatus `bson:"status" json:"status"` // 退换状态
Priority int `bson:"priority" json:"priority"` // 优先级
// 地址信息
ReturnAddress string `bson:"returnAddress" json:"returnAddress"` // 退货地址
ReturnContact string `bson:"returnContact" json:"returnContact"` // 退货联系人
ReturnPhone string `bson:"returnPhone" json:"returnPhone"` // 退货联系电话
ReceiveAddress string `bson:"receiveAddress" json:"receiveAddress"` // 收货地址(换货时使用)
// 物流信息
LogisticsCompany string `bson:"logisticsCompany" json:"logisticsCompany"` // 物流公司
TrackingNo string `bson:"trackingNo" json:"trackingNo"` // 物流单号
ShipAt *gtime.Time `bson:"shipAt" json:"shipAt"` // 发货时间
ReceiveAt *gtime.Time `bson:"receiveAt" json:"receiveAt"` // 收货时间
// 审批信息
ApprovalStatus consts.ApprovalStatus `bson:"approvalStatus" json:"approvalStatus"` // 审批状态
ApprovedBy string `bson:"approvedBy" json:"approvedBy"` // 审批人ID
ApprovedAt *gtime.Time `bson:"approvedAt" json:"approvedAt"` // 审批时间
ApprovalRemark string `bson:"approvalRemark" json:"approvalRemark"` // 审批备注
// 时间戳
RequestedAt *gtime.Time `bson:"requestedAt" json:"requestedAt"` // 申请时间
ExpectedProcessAt *gtime.Time `bson:"expectedProcessAt" json:"expectedProcessAt"` // 期望处理时间
CompletedAt *gtime.Time `bson:"completedAt" json:"completedAt"` // 完成时间
// 备注信息
Remark string `bson:"remark" json:"remark"` // 备注
InternalRemark string `bson:"internalRemark" json:"internalRemark"` // 内部备注
}
// CollectionName 获取集合名称
func (PurchaseReturn) CollectionName() string {
return public.PurchaseReturnCollection
}

View File

@@ -0,0 +1,57 @@
package entity
import (
consts "assets/consts/procurement"
"assets/consts/public"
"gitea.com/red-future/common/beans"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PurchaseReturnItem 采购退换单明细实体
type PurchaseReturnItem struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息
ReturnId *bson.ObjectID `bson:"returnId" json:"returnId"` // 退换单ID
OrderId *bson.ObjectID `bson:"orderId" json:"orderId"` // 采购订单ID
OrderItemId *bson.ObjectID `bson:"orderItemId" json:"orderItemId"` // 订单明细ID
// 商品信息
AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 资产ID
AssetSkuId *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 资产SKU ID
ProductName string `bson:"productName" json:"productName"` // 商品名称
Specification string `bson:"specification" json:"specification"` // 规格
Brand string `bson:"brand" json:"brand"` // 品牌
Unit string `bson:"unit" json:"unit"` // 单位
// 数量和价格信息
OriginalQuantity int `bson:"originalQuantity" json:"originalQuantity"` // 原始采购数量
ReturnQuantity int `bson:"returnQuantity" json:"returnQuantity"` // 退换数量
UnitPrice int `bson:"unitPrice" json:"unitPrice"` // 单价(分)
TotalPrice int `bson:"totalPrice" json:"totalPrice"` // 退换小计(分)
RefundPrice int `bson:"refundPrice" json:"refundPrice"` // 实际退款金额(分)
// 退换原因和处理信息
Reason consts.ReturnReason `bson:"reason" json:"reason"` // 退换原因
ReasonDetail string `bson:"reasonDetail" json:"reasonDetail"` // 详细原因说明
ProblemDesc string `bson:"problemDesc" json:"problemDesc"` // 问题描述
ProblemImages []string `bson:"problemImages" json:"problemImages"` // 问题图片URL列表
// 状态信息
Status consts.ReturnItemStatus `bson:"status" json:"status"` // 明细状态
ProcessMethod consts.ProcessMethod `bson:"processMethod" json:"processMethod"` // 处理方式
// 处理结果
ProcessedQuantity int `bson:"processedQuantity" json:"processedQuantity"` // 已处理数量
RemainingQuantity int `bson:"remainingQuantity" json:"remainingQuantity"` // 剩余待处理数量
ProcessResult string `bson:"processResult" json:"processResult"` // 处理结果描述
// 备注
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (PurchaseReturnItem) CollectionName() string {
return public.PurchaseReturnItemCollection
}

View File

@@ -0,0 +1,87 @@
package entity
import (
consts "assets/consts/procurement"
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
)
// Supplier 供应商实体
type Supplier struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 基础信息
Name string `bson:"name" json:"name"` // 供应商名称(必填)
Code string `bson:"code" json:"code"` // 供应商编码(必填,唯一)
ShortName string `bson:"shortName" json:"shortName"` // 供应商简称
Alias []string `bson:"alias" json:"alias"` // 别名列表
Logo string `bson:"logo" json:"logo"` // 供应商LOGO URL
// 联系信息
Phone string `bson:"phone" json:"phone"` // 固定电话
Mobile string `bson:"mobile" json:"mobile"` // 手机号码
Email string `bson:"email" json:"email"` // 邮箱地址
Website string `bson:"website" json:"website"` // 官网地址
ContactPerson string `bson:"contactPerson" json:"contactPerson"` // 联系人姓名
ContactPhone string `bson:"contactPhone" json:"contactPhone"` // 联系人电话
ContactEmail string `bson:"contactEmail" json:"contactEmail"` // 联系人邮箱
ContactPosition string `bson:"contactPosition" json:"contactPosition"` // 联系人职位
// 地址信息
Country string `bson:"country" json:"country"` // 国家
Province string `bson:"province" json:"province"` // 省份
City string `bson:"city" json:"city"` // 城市
District string `bson:"district" json:"district"` // 区县
Address string `bson:"address" json:"address"` // 详细地址
PostalCode string `bson:"postalCode" json:"postalCode"` // 邮政编码
// 企业资质信息
BusinessLicense string `bson:"businessLicense" json:"businessLicense"` // 营业执照号
LegalPerson string `bson:"legalPerson" json:"legalPerson"` // 法定代表人
TaxNumber string `bson:"taxNumber" json:"taxNumber"` // 税务登记号
BankName string `bson:"bankName" json:"bankName"` // 开户银行
BankAccount string `bson:"bankAccount" json:"bankAccount"` // 银行账号
BankAccountName string `bson:"bankAccountName" json:"bankAccountName"` // 账户名称
// 业务合作信息
CooperationStart *gtime.Time `bson:"cooperationStart" json:"cooperationStart"` // 合作开始时间
CooperationEnd *gtime.Time `bson:"cooperationEnd" json:"cooperationEnd"` // 合作结束时间
SupplierLevel string `bson:"supplierLevel" json:"supplierLevel"` // 供应商等级
PaymentMethod string `bson:"paymentMethod" json:"paymentMethod"` // 结算方式
PaymentPeriod int `bson:"paymentPeriod" json:"paymentPeriod"` // 付款周期(天)
TaxRate float64 `bson:"taxRate" json:"taxRate"` // 税率如0.13表示13%
MinOrderAmount int `bson:"minOrderAmount" json:"minOrderAmount"` // 最小订货金额(分)
// 经营品类信息
MainCategories []string `bson:"mainCategories" json:"mainCategories"` // 主营品类ID列表
BusinessScope string `bson:"businessScope" json:"businessScope"` // 经营范围
// 状态和审核信息
Status consts.SupplierStatus `bson:"status" json:"status"` // 供应商状态
ReviewStatus consts.ReviewStatus `bson:"reviewStatus" json:"reviewStatus"` // 审核状态
ReviewBy string `bson:"reviewBy" json:"reviewBy"` // 审核人ID
ReviewAt *gtime.Time `bson:"reviewAt" json:"reviewAt"` // 审核时间
ReviewRemark string `bson:"reviewRemark" json:"reviewRemark"` // 审核备注
// 评分和评价
Rating float64 `bson:"rating" json:"rating"` // 综合评分0-5分
DeliveryRating float64 `bson:"deliveryRating" json:"deliveryRating"` // 交货及时率评分
QualityRating float64 `bson:"qualityRating" json:"qualityRating"` // 质量合格率评分
ServiceRating float64 `bson:"serviceRating" json:"serviceRating"` // 服务满意度评分
TotalOrders int64 `bson:"totalOrders" json:"totalOrders"` // 历史订单总数
TotalAmount int64 `bson:"totalAmount" json:"totalAmount"` // 历史交易总额(分)
// 备注和标签
Remark string `bson:"remark" json:"remark"` // 备注信息
Tags []string `bson:"tags" json:"tags"` // 标签列表
// 扩展字段
Extra map[string]interface{} `bson:"extra" json:"extra"` // 扩展字段
}
// CollectionName 获取集合名称
func (Supplier) CollectionName() string {
return public.SupplierCollection
}

View File

@@ -0,0 +1,56 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// InventoryCount 库存盘点主表实体(盘点任务执行时冻结所选盘点范围的库存)
type InventoryCount struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 基本信息
CountNo string `bson:"countNo" json:"countNo"` // 盘点单号
Title string `bson:"title" json:"title"` // 盘点标题
Description string `bson:"description" json:"description"` // 盘点描述
WarehouseIDs []*bson.ObjectID `bson:"warehouseIds" json:"warehouseIds"` // 仓库ID列表
ZoneIDs []*bson.ObjectID `bson:"zoneIds" json:"zoneIds"` // 库区ID列表
LocationIDs []*bson.ObjectID `bson:"locationIds" json:"locationIds"` // 库位ID列表
AssetSkuIDs []*bson.ObjectID `bson:"assetSkuIds" json:"assetSkuIds"` // 资产SKU ID列表
// 盘点范围
IsFrozen bool `bson:"isFrozen" json:"isFrozen"` //是否冻结(冻结时不允许修改)
CountType stock.InventoryCountType `bson:"countType" json:"countType"` // 盘点类型
Scope stock.InventoryCountScope `bson:"scope" json:"scope"` // 盘点范围
// 时间信息
ActualStartTime *gtime.Time `bson:"actualStartTime" json:"actualStartTime"` // 实际开始时间
ActualEndTime *gtime.Time `bson:"actualEndTime" json:"actualEndTime"` // 实际结束时间
// 状态信息
Status stock.InventoryCountStatus `bson:"status" json:"status"` // 盘点状态
Progress float64 `bson:"progress" json:"progress"` // 进度百分比 0-100
// 人员信息
CreatorID string `bson:"creatorId" json:"creatorId"` // 创建人ID
AssigneeID string `bson:"assigneeId" json:"assigneeId"` // 负责人ID
AssigneeName string `bson:"assigneeName" json:"assigneeName"` // 负责人名称
Participants []string `bson:"participants" json:"participants"` // 参与人员ID列表
// 统计信息
TotalItems int `bson:"totalItems" json:"totalItems"` // 盘点条目总数
CompletedItems int `bson:"completedItems" json:"completedItems"` // 已完成条目数
DiscrepancyItems int `bson:"discrepancyItems" json:"discrepancyItems"` // 有差异条目数
// 备注信息
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (InventoryCount) CollectionName() string {
return public.InventoryCountCollection
}

View File

@@ -0,0 +1,39 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// InventoryCountAdjustHistory 盘点调整历史表实体
type InventoryCountAdjustHistory struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息
CountID *bson.ObjectID `bson:"countId" json:"countId"` // 盘点任务ID
DetailID *bson.ObjectID `bson:"detailId" json:"detailId"` // 盘点明细ID
AssetSkuID *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 商品SKU ID
WarehouseID *bson.ObjectID `bson:"warehouseId" json:"warehouseId"` // 仓库ID
ZoneID *bson.ObjectID `bson:"zoneId" json:"zoneId"` // 库区ID
LocationID *bson.ObjectID `bson:"locationId" json:"locationId"` // 库位ID
// 调整数据
BeforeQuantity int `bson:"beforeQuantity" json:"beforeQuantity"` // 调整前库存
AfterQuantity int `bson:"afterQuantity" json:"afterQuantity"` // 调整后库存
Difference int `bson:"difference" json:"difference"` // 差值(可正可负)
// 元数据
Reason string `bson:"reason" json:"reason"` // 调整原因
AdjustedBy string `bson:"adjustedBy" json:"adjustedBy"` // 调整人ID
AdjustedByName string `bson:"adjustedByName" json:"adjustedByName"` // 调整人姓名
AdjustedAt *gtime.Time `bson:"adjustedAt" json:"adjustedAt"` // 调整时间
BatchNo string `bson:"batchNo" json:"batchNo"` // 批次号(批量调整时)
}
// CollectionName 获取集合名称
func (InventoryCountAdjustHistory) CollectionName() string {
return public.InventoryCountAdjustHistoryCollection
}

View File

@@ -0,0 +1,60 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// InventoryCountDetail 库存盘点明细表实体
type InventoryCountDetail struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息
CountID *bson.ObjectID `bson:"countId" json:"countId"` // 盘点单ID
AssetID *bson.ObjectID `bson:"assetId" json:"assetId"` // 资产ID
AssetSkuID *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 资产SKU ID
WarehouseID *bson.ObjectID `bson:"warehouseId" json:"warehouseId"` // 仓库ID
ZoneID *bson.ObjectID `bson:"zoneId" json:"zoneId"` // 库区ID
LocationID *bson.ObjectID `bson:"locationId" json:"locationId"` // 库位ID
// 账面数据
BookQuantity int `bson:"bookQuantity" json:"bookQuantity"` // 账面数量
BookBatchInfo map[string]int `bson:"bookBatchInfo" json:"bookBatchInfo"` // 账面批次信息 {batchNo: quantity}
// 实盘数据
ActualQuantity int `bson:"actualQuantity" json:"actualQuantity"` // 实盘数量
ActualBatchInfo map[string]int `bson:"actualBatchInfo" json:"actualBatchInfo"` // 实盘批次信息 {batchNo: quantity}
CountBy string `bson:"countBy" json:"countBy"` // 盘点人ID
CountAt *gtime.Time `bson:"countAt" json:"countAt"` // 盘点时间
// 差异信息
Difference int `bson:"difference" json:"difference"` // 差异数量 (实际-账面)
DifferenceRate float64 `bson:"differenceRate" json:"differenceRate"` // 差异率
DiscrepancyType stock.DiscrepancyType `bson:"discrepancyType" json:"discrepancyType"` // 差异类型
DiscrepancyReason string `bson:"discrepancyReason" json:"discrepancyReason"` // 差异原因
// 状态信息
Status stock.InventoryDetailStatus `bson:"status" json:"status"` // 明细状态
IsAdjusted bool `bson:"isAdjusted" json:"isAdjusted"` // 是否已调整
AdjustedAt *gtime.Time `bson:"adjustedAt" json:"adjustedAt"` // 调整时间
AdjustedBy string `bson:"adjustedBy" json:"adjustedBy"` // 调整人ID
AdjustedByName string `bson:"adjustedByName" json:"adjustedByName"` // 调整人姓名
// 上传信息
UploadBy string `bson:"uploadBy" json:"uploadBy"` // 上传人ID
UploadByName string `bson:"uploadByName" json:"uploadByName"` // 上传人姓名
UploadAt *gtime.Time `bson:"uploadAt" json:"uploadAt"` // 上传时间
UploadFileName string `bson:"uploadFileName" json:"uploadFileName"` // 文件名
// 备注信息
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (InventoryCountDetail) CollectionName() string {
return public.InventoryCountDetailCollection
}

View File

@@ -0,0 +1,54 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// InventoryWarning 库存预警实体
type InventoryWarning struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 预警类型
WarningType stock.WarningType `bson:"warningType" json:"warningType"` // 预警类型
// 关联信息
BatchID *bson.ObjectID `bson:"batchId" json:"batchId"` // 关联批次ID
AssetID *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
AssetSkuID *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 关联资产SKU ID
SupplierID *bson.ObjectID `bson:"supplierId" json:"supplierId"` // 关联供应商ID
BatchNo string `bson:"batchNo" json:"batchNo"` // 批次号
BatchQty int `bson:"batchQty" json:"batchQty"` // 批次数量
AvailableQty int `bson:"availableQty" json:"availableQty"` // 可用数量
// 时间信息(临期预警使用)
ProductionDate *gtime.Time `bson:"productionDate" json:"productionDate"` // 生产日期
ExpiryDate *gtime.Time `bson:"expiryDate" json:"expiryDate"` // 过期日期
ExpiryWarningDate *gtime.Time `bson:"expiryWarningDate" json:"expiryWarningDate"` // 临期预警时间
// 库存信息(库存不足预警使用)
MinStockThreshold int `bson:"minStockThreshold" json:"minStockThreshold"` // 最低库存阈值
// 消息状态
Status stock.ExpiryMessageStatus `bson:"status" json:"status"` // 消息状态
// 处理信息
ProcessedAt *gtime.Time `bson:"processedAt" json:"processedAt"` // 处理时间
Processor string `bson:"processor" json:"processor"` // 处理人
ProcessNote string `bson:"processNote" json:"processNote"` // 处理备注
ProcessMethod *stock.ExpiryProcessMethod `bson:"processMethod" json:"processMethod"` // 处理方式
PromotionPlanID string `bson:"promotionPlanId" json:"promotionPlanId"` // 促销方案ID
// 其他信息
SupportsRecycle bool `bson:"supportsRecycle" json:"supportsRecycle"` // 是否支持回收
Notes string `bson:"notes" json:"notes"` // 备注
}
// CollectionName 获取集合名称
func (InventoryWarning) CollectionName() string {
return public.InventoryWarningCollection
}

View File

@@ -0,0 +1,43 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// InventoryWarningHistory 库存预警历史归档实体
type InventoryWarningHistory struct {
beans.MongoBaseDO `bson:",inline"`
// 预警类型
WarningType stock.WarningType `bson:"warningType" json:"warningType"` // 预警类型
BatchID *bson.ObjectID `bson:"batchId" json:"batchId"`
AssetID *bson.ObjectID `bson:"assetId" json:"assetId"`
AssetSkuID *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"`
SupplierID *bson.ObjectID `bson:"supplierId" json:"supplierId"`
BatchNo string `bson:"batchNo" json:"batchNo"`
BatchQty int `bson:"batchQty" json:"batchQty"`
AvailableQty int `bson:"availableQty" json:"availableQty"`
ProductionDate *gtime.Time `bson:"productionDate" json:"productionDate"`
ExpiryDate *gtime.Time `bson:"expiryDate" json:"expiryDate"`
ExpiryWarningDate *gtime.Time `bson:"expiryWarningDate" json:"expiryWarningDate"`
MinStockThreshold int `bson:"minStockThreshold" json:"minStockThreshold"` // 最低库存阈值
Status stock.ExpiryMessageStatus `bson:"status" json:"status"`
ProcessedAt *gtime.Time `bson:"processedAt" json:"processedAt"`
Processor string `bson:"processor" json:"processor"`
ProcessNote string `bson:"processNote" json:"processNote"`
ProcessMethod *stock.ExpiryProcessMethod `bson:"processMethod" json:"processMethod"`
PromotionPlanID string `bson:"promotionPlanId" json:"promotionPlanId"`
SupportsRecycle bool `bson:"supportsRecycle" json:"supportsRecycle"`
Notes string `bson:"notes" json:"notes"`
}
// CollectionName 获取集合名称
func (InventoryWarningHistory) CollectionName() string {
return public.InventoryWarningHistoryCollection
}

View File

@@ -0,0 +1,29 @@
package entity
import (
"assets/consts/public"
consts "assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
"go.mongodb.org/mongo-driver/v2/bson"
)
// Location 库位
type Location struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
WarehouseId *bson.ObjectID `bson:"warehouseId" json:"warehouseId"` // 仓库ID
ZoneId *bson.ObjectID `bson:"zoneId" json:"zoneId"` // 库区ID
LocationCode string `bson:"locationCode" json:"locationCode"` // 库位编码
LocationName string `bson:"locationName" json:"locationName"` // 库位名称
LocationType consts.LocationType `bson:"locationType" json:"locationType"` // 库位类型
Status consts.LocationStatus `bson:"status" json:"status"` // 库位状态
CapacityUnitType consts.CapacityUnitType `bson:"capacityUnitType" json:"capacityUnitType"` // 容量单位类型
Capacity *config.Capacity `bson:"capacity" json:"capacity"` //容量
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (Location) CollectionName() string {
return public.LocationCollection
}

View File

@@ -0,0 +1,56 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// PrivateStock 实物库存批次记录SKU批次在具体仓库/库区/库位的实际存放位置和数量)
type PrivateStock struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 关联信息 - 支持多种库存类型
StockType stock.StockLocationType `bson:"stockType" json:"stockType"` // 库存类型stock_details/private_stock/stock_batch
// 位置信息
WarehouseID *bson.ObjectID `bson:"warehouseId" json:"warehouseId"` // 仓库ID
WarehouseCode string `bson:"warehouseCode" json:"warehouseCode"` // 仓库编码
WarehouseName string `bson:"warehouseName" json:"warehouseName"` // 仓库名称
ZoneID *bson.ObjectID `bson:"zoneId" json:"zoneId"` // 库区ID可选
ZoneCode string `bson:"zoneCode" json:"zoneCode"` // 库区编码
ZoneName string `bson:"zoneName" json:"zoneName"` // 库区名称
ZoneType stock.ZoneType `bson:"zoneType" json:"zoneType"` // 库区类型
LocationID *bson.ObjectID `bson:"locationId" json:"locationId"` // 库位ID可选
LocationCode string `bson:"locationCode" json:"locationCode"` // 库位编码
LocationName string `bson:"locationName" json:"locationName"` // 库位名称
LocationType stock.LocationType `bson:"locationType" json:"locationType"` // 库位类型
PrivateSkuID *bson.ObjectID `bson:"privateSkuId" json:"privateSkuId"` // 私域SKU ID
BatchNo string `bson:"batchNo" json:"batchNo"` // 批次号
BatchQty int `bson:"batchQty" json:"batchQty"` // 批次总数量(入库后不可变)
AvailableQty int `bson:"availableQty" json:"availableQty"` // 可用数量(实时变化)
// 状态
BatchStatus stock.BatchStatus `bson:"batchStatus" json:"batchStatus"` // 批次状态
// 订单关联
OrderID *bson.ObjectID `bson:"orderId" json:"orderId"` // 关联订单ID如果有
// 供应商关联和临期管理
SupplierID *bson.ObjectID `bson:"supplierId" json:"supplierId"` // 关联供应商ID
SupportsRecycle bool `bson:"supportsRecycle" json:"supportsRecycle"` // 是否支持回收
ProductionDate *gtime.Time `bson:"productionDate" json:"productionDate"` // 生产日期
ExpiryDate *gtime.Time `bson:"expiryDate" json:"expiryDate"` // 过期日期
ExpiryWarningDate *gtime.Time `bson:"expiryWarningDate" json:"expiryWarningDate"` // 临期预警时间(有过期日期时建议填写)
PrivateCategoryPath string `bson:"privateCategoryPath" json:"privateCategoryPath"` // 私域分类路径
StockStatus stock.StockStatus `bson:"stockStatus" json:"stockStatus"` // 库存状态
LastMovedAt *gtime.Time `bson:"lastMovedAt" json:"lastMovedAt"` // 最后移动时间
}
// CollectionName 获取集合名称
func (PrivateStock) CollectionName() string {
return public.PrivateStockCollection
}

View File

@@ -0,0 +1,48 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// StockBatch 库存批次实体(用于批次管理模式)
type StockBatch struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
AssetID *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
AssetSkuID *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 关联资产SKU ID
BatchNo string `bson:"batchNo" json:"batchNo"` // 批次号
BatchQty int `bson:"batchQty" json:"batchQty"` // 批次总数量(入库后不可变)
AvailableQty int `bson:"availableQty" json:"availableQty"` // 可用数量(实时变化)
// 批次元数据
Metadata []map[string]interface{} `bson:"metadata" json:"metadata"` // 其他元数据
// 状态
Status *stock.BatchStatus `bson:"status" json:"status"` // 批次状态
// 锁定数量 = BatchQty - AvailableQty
// 订单关联
OrderID *bson.ObjectID `bson:"orderId" json:"orderId"` // 关联订单ID如果有
// 渠道分配信息
AssignedChannel string `bson:"assignedChannel" json:"assignedChannel"` // 分配的销售渠道
ChannelSKU string `bson:"channelSku" json:"channelSku"` // 渠道商品SKU
ChannelMetadata map[string]interface{} `bson:"channelMetadata" json:"channelMetadata"` // 渠道专属数据
AllocatedAt *gtime.Time `bson:"allocatedAt" json:"allocatedAt"` // 分配时间
// 临期管理
ProductionDate *gtime.Time `bson:"productionDate" json:"productionDate"` // 生产日期
ExpiryDate *gtime.Time `bson:"expiryDate" json:"expiryDate"` // 过期日期
ExpiryWarningDate *gtime.Time `bson:"expiryWarningDate" json:"expiryWarningDate"` // 临期预警时间(有过期日期时建议填写)
CategoryPath string `bson:"categoryPath" json:"categoryPath"` // 分类路径
}
// CollectionName 获取集合名称
func (StockBatch) CollectionName() string {
return public.StockBatchCollection
}

View File

@@ -0,0 +1,35 @@
package entity
import (
"assets/consts/public"
"assets/consts/stock"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// StockDetails 库存实体每一件商品都有独立ID用于后期做区块链虚拟资产
type StockDetails struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
AssetSkuId *bson.ObjectID `bson:"assetSkuId" json:"assetSkuId"` // 关联资产SKU ID
Status stock.StockStatus `bson:"status" json:"status"` // 库存状态
OrderId *bson.ObjectID `bson:"orderId" json:"orderId"` // 关联订单ID如果有
LockExpire *gtime.Time `bson:"lockExpire" json:"lockExpire"` // 锁定过期时间
Metadata []map[string]interface{} `bson:"metadata" json:"metadata"` // 其他元数据
TokenId string `bson:"tokenId" json:"tokenId"` // 区块链TokenID如果有
// 渠道分配信息
AssignedChannel string `bson:"assignedChannel" json:"assignedChannel"` // 分配的销售渠道
ChannelSKU string `bson:"channelSku" json:"channelSku"` // 渠道商品SKU
ChannelMetadata map[string]interface{} `bson:"channelMetadata" json:"channelMetadata"` // 渠道专属数据
AllocatedAt *gtime.Time `bson:"allocatedAt" json:"allocatedAt"` // 分配时间
CategoryPath string `bson:"categoryPath" json:"categoryPath"` // 分类路径
}
// CollectionName 库存集合名称
func (StockDetails) CollectionName() string {
return public.StockDetailsCollection
}

View File

@@ -0,0 +1,25 @@
package entity
import (
"assets/consts/public"
consts "assets/consts/stock"
"gitea.com/red-future/common/beans"
)
// UnitConversion 单位换算
type UnitConversion struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
ConversionCode string `bson:"conversionCode" json:"conversionCode"` // 换算编码
ConversionName string `bson:"conversionName" json:"conversionName"` // 换算名称
UnitType consts.CapacityUnitType `bson:"unitType" json:"unitType"` // 单位类型
FromUnit string `bson:"fromUnit" json:"fromUnit"` // 源单位
ToUnit string `bson:"toUnit" json:"toUnit"` // 目标单位
ConversionFactor float64 `bson:"conversionFactor" json:"conversionFactor"` // 换算系数1 toUnit = ConversionFactor × fromUnit如1箱=20瓶则factor=20
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (UnitConversion) CollectionName() string {
return public.UnitConversionCollection
}

View File

@@ -0,0 +1,27 @@
package entity
import (
public "assets/consts/public"
consts "assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
)
// Warehouse 仓库
type Warehouse struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
WarehouseCode string `bson:"warehouseCode" json:"warehouseCode"` // 仓库编码
WarehouseName string `bson:"warehouseName" json:"warehouseName"` // 仓库名称
Address string `bson:"address" json:"address"` // 仓库地址
ContactPerson string `bson:"contactPerson" json:"contactPerson"` // 联系人
ContactPhone string `bson:"contactPhone" json:"contactPhone"` // 联系电话
Status consts.WarehouseStatus `bson:"status" json:"status"` // 仓库状态
Capacity *map[consts.CapacityUnitType]config.Capacity `bson:"capacity" json:"capacity"` // 容量
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (Warehouse) CollectionName() string {
return public.WarehouseCollection
}

View File

@@ -0,0 +1,26 @@
package entity
import (
public "assets/consts/public"
consts "assets/consts/stock"
"assets/model/config"
"gitea.com/red-future/common/beans"
)
// Zone 库区
type Zone struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
WarehouseId string `bson:"warehouseId" json:"warehouseId"` // 仓库ID
ZoneCode string `bson:"zoneCode" json:"zoneCode"` // 库区编码
ZoneName string `bson:"zoneName" json:"zoneName"` // 库区名称
ZoneType consts.ZoneType `bson:"zoneType" json:"zoneType"` // 库区类型
Status consts.ZoneStatus `bson:"status" json:"status"` // 库区状态
Capacity *map[consts.CapacityUnitType]config.Capacity `bson:"capacity" json:"capacity"` // 容量
Remark string `bson:"remark" json:"remark"` // 备注
}
// CollectionName 获取集合名称
func (Zone) CollectionName() string {
return public.ZoneCollection
}

View File

@@ -0,0 +1,108 @@
package entity
import "gitea.com/red-future/common/beans"
// ChannelConfig 渠道配置 - 租户针对三方渠道的配置信息
type ChannelConfig struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段
// 渠道专用配置
TaobaoConfig *TaobaoConfig `bson:"taobaoConfig,omitempty" json:"taobaoConfig,omitempty"`
JDConfig *JDConfig `bson:"jdConfig,omitempty" json:"jdConfig,omitempty"`
KuaishouConfig *KuaishouConfig `bson:"kuaishouConfig,omitempty" json:"kuaishouConfig,omitempty"`
DouyinConfig *DouyinConfig `bson:"douyinConfig,omitempty" json:"douyinConfig,omitempty"`
XhsConfig *XhsConfig `bson:"xhsConfig,omitempty" json:"xhsConfig,omitempty"`
PddConfig *PddConfig `bson:"pddConfig,omitempty" json:"pddConfig,omitempty"`
XianyuConfig *XianyuConfig `bson:"xianyuConfig,omitempty" json:"xianyuConfig,omitempty"`
BlockchainConfig *BlockchainConfig `bson:"blockchainConfig,omitempty" json:"blockchainConfig,omitempty"`
}
// 各渠道专用配置结构
// TaobaoConfig 淘宝配置
type TaobaoConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
RefreshToken string `bson:"refreshToken" json:"refreshToken"` // 刷新令牌
ShopID string `bson:"shopId" json:"shopId"` // 店铺ID
SellerID string `bson:"sellerId" json:"sellerId"` // 卖家ID
}
// JDConfig 京东配置
type JDConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
VenderID string `bson:"venderId" json:"venderId"` // 商家ID
WarehouseID string `bson:"warehouseId" json:"warehouseId"` // 仓库ID
}
// KuaishouConfig 快手配置
type KuaishouConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
AppID string `bson:"appId" json:"appId"` // 应用ID
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
LiveRoomID string `bson:"liveRoomId" json:"liveRoomId"` // 直播间ID
}
// DouyinConfig 抖音配置
type DouyinConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
AppID string `bson:"appId" json:"appId"` // 应用ID
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
LiveRoomID string `bson:"liveRoomId" json:"liveRoomId"` // 直播间ID
VideoID string `bson:"videoId" json:"videoId"` // 视频ID
}
// XhsConfig 小红书配置
type XhsConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
NoteID string `bson:"noteId" json:"noteId"` // 笔记ID
}
// PddConfig 拼多多配置
type PddConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
ClientID string `bson:"clientId" json:"clientId"` // 客户端ID
ClientSecret string `bson:"clientSecret" json:"clientSecret"` // 客户端密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
MallID string `bson:"mallId" json:"mallId"` // 店铺ID
}
// XianyuConfig 闲鱼配置
type XianyuConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
}
// BlockchainConfig 区块链配置
type BlockchainConfig struct {
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
ChainName string `bson:"chainName" json:"chainName"` // 链名称
ContractAddress string `bson:"contractAddress" json:"contractAddress"` // 合约地址
PrivateKey string `bson:"privateKey" json:"privateKey"` // 私钥
RPCURL string `bson:"rpcUrl" json:"rpcUrl"` // RPC地址
}
// CollectionName 渠道配置集合名称
func (ChannelConfig) CollectionName() string {
return "channel_config"
}

View File

@@ -0,0 +1,45 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// ChannelSyncRecord 渠道同步记录
type ChannelSyncRecord struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段
// 关联关系
AssetID *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
SkuID *bson.ObjectID `bson:"skuId" json:"skuId"` // 关联SKU ID
Channel public.SyncPlatform `bson:"channel" json:"channel"` // 渠道类型
// 同步状态信息
Status public.SyncStatus `bson:"status" json:"status"` // 同步状态
// 渠道商品信息
ChannelProductID *bson.ObjectID `bson:"channelProductId" json:"channelProductId"` // 渠道商品ID
ChannelSkuID *bson.ObjectID `bson:"channelSkuId" json:"channelSkuId"` // 渠道SKU ID
ChannelURL string `bson:"channelUrl" json:"channelUrl"` // 渠道商品链接
// 同步信息
LastSyncTime *gtime.Time `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
LastSyncResult *SyncResult `bson:"lastSyncResult" json:"lastSyncResult"` // 最后同步结果
ErrorCount int `bson:"errorCount" json:"errorCount"` // 错误次数
}
// CollectionName 渠道同步记录集合名称
func (ChannelSyncRecord) CollectionName() string {
return "channel_sync_record"
}
// SyncResult 同步结果
type SyncResult struct {
Success bool `bson:"success" json:"success"` // 是否成功
ErrorMsg string `bson:"errorMsg" json:"errorMsg"` // 错误信息
SyncTime *gtime.Time `bson:"syncTime" json:"syncTime"` // 同步时间
Data map[string]interface{} `bson:"data" json:"data"` // 同步数据
}

View File

@@ -0,0 +1,30 @@
package entity
import (
"assets/consts/public"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/os/gtime"
"go.mongodb.org/mongo-driver/v2/bson"
)
// SyncTask 同步任务实体
type SyncTask struct {
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
Platform public.SyncPlatform `json:"platform" bson:"platform"`
SyncType public.SyncType `json:"syncType" bson:"syncType"`
Status public.SyncStatus `json:"status" bson:"status"`
AssetID *bson.ObjectID `json:"assetId" bson:"assetId"`
AssetSKUID *bson.ObjectID `json:"assetSkuId" bson:"assetSkuId"`
StockID *bson.ObjectID `json:"stockId" bson:"stockId"`
ErrorMessage string `json:"errorMessage" bson:"errorMessage"`
ErrorCount int `json:"errorCount" bson:"errorCount"`
StartedAt *gtime.Time `json:"startedAt" bson:"startedAt"`
FinishedAt *gtime.Time `json:"finishedAt" bson:"finishedAt"`
}
// CollectionName 获取集合名称
func (SyncTask) CollectionName() string {
return "sync_task"
}