Dockerfile
This commit is contained in:
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
|
||||
}
|
||||
Reference in New Issue
Block a user