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

233 lines
11 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import (
"assets/consts/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列表
}