Dockerfile
This commit is contained in:
43
model/entity/asset/asset.go
Normal file
43
model/entity/asset/asset.go
Normal 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:"租户模块类型"`
|
||||
}
|
||||
44
model/entity/asset/asset_sku.go
Normal file
44
model/entity/asset/asset_sku.go
Normal 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
|
||||
}
|
||||
74
model/entity/asset/category.go
Normal file
74
model/entity/asset/category.go
Normal 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:"选项值"`
|
||||
}
|
||||
25
model/entity/asset/private_category.go
Normal file
25
model/entity/asset/private_category.go
Normal 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
|
||||
}
|
||||
27
model/entity/asset/private_sku.go
Normal file
27
model/entity/asset/private_sku.go
Normal 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
|
||||
}
|
||||
46
model/entity/procurement/purchase_bid.go
Normal file
46
model/entity/procurement/purchase_bid.go
Normal 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
|
||||
}
|
||||
47
model/entity/procurement/purchase_inbound.go
Normal file
47
model/entity/procurement/purchase_inbound.go
Normal 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
|
||||
}
|
||||
91
model/entity/procurement/purchase_order.go
Normal file
91
model/entity/procurement/purchase_order.go
Normal 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
|
||||
}
|
||||
42
model/entity/procurement/purchase_order_item.go
Normal file
42
model/entity/procurement/purchase_order_item.go
Normal 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
|
||||
}
|
||||
74
model/entity/procurement/purchase_return.go
Normal file
74
model/entity/procurement/purchase_return.go
Normal 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
|
||||
}
|
||||
57
model/entity/procurement/purchase_return_item.go
Normal file
57
model/entity/procurement/purchase_return_item.go
Normal 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
|
||||
}
|
||||
87
model/entity/procurement/supplier.go
Normal file
87
model/entity/procurement/supplier.go
Normal 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
|
||||
}
|
||||
56
model/entity/stock/inventory_count.go
Normal file
56
model/entity/stock/inventory_count.go
Normal 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
|
||||
}
|
||||
39
model/entity/stock/inventory_count_adjust_history.go
Normal file
39
model/entity/stock/inventory_count_adjust_history.go
Normal 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
|
||||
}
|
||||
60
model/entity/stock/inventory_count_detail.go
Normal file
60
model/entity/stock/inventory_count_detail.go
Normal 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
|
||||
}
|
||||
54
model/entity/stock/inventory_warning.go
Normal file
54
model/entity/stock/inventory_warning.go
Normal 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
|
||||
}
|
||||
43
model/entity/stock/inventory_warning_history.go
Normal file
43
model/entity/stock/inventory_warning_history.go
Normal 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
|
||||
}
|
||||
29
model/entity/stock/location.go
Normal file
29
model/entity/stock/location.go
Normal 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
|
||||
}
|
||||
56
model/entity/stock/private_stock.go
Normal file
56
model/entity/stock/private_stock.go
Normal 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
|
||||
}
|
||||
48
model/entity/stock/stock_batch.go
Normal file
48
model/entity/stock/stock_batch.go
Normal 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
|
||||
}
|
||||
35
model/entity/stock/stock_details.go
Normal file
35
model/entity/stock/stock_details.go
Normal 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
|
||||
}
|
||||
25
model/entity/stock/unit_conversion.go
Normal file
25
model/entity/stock/unit_conversion.go
Normal 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
|
||||
}
|
||||
27
model/entity/stock/warehouse.go
Normal file
27
model/entity/stock/warehouse.go
Normal 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
|
||||
}
|
||||
26
model/entity/stock/zone.go
Normal file
26
model/entity/stock/zone.go
Normal 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
|
||||
}
|
||||
108
model/entity/sync/channel_config.go
Normal file
108
model/entity/sync/channel_config.go
Normal 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"
|
||||
}
|
||||
45
model/entity/sync/channel_sync_record.go
Normal file
45
model/entity/sync/channel_sync_record.go
Normal 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"` // 同步数据
|
||||
}
|
||||
30
model/entity/sync/sync_task.go
Normal file
30
model/entity/sync/sync_task.go
Normal 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"
|
||||
}
|
||||
Reference in New Issue
Block a user