feat(erp): 添加采购商品关联信息- 在产品详情中增加采购商品列表字段

- 扩展出舱单产品与采购商品的关联结构
- 新增采购商品详情信息结构体定义
- 支持在出运产品中关联多个采购商品- 完善产品添加和编辑时的采购商品数据处理
This commit is contained in:
守护自己的云 2025-09-28 15:40:39 +08:00
parent 9aba2baa8c
commit 0593a556e4
3 changed files with 435 additions and 356 deletions

View File

@ -2,12 +2,13 @@ package sale
import (
"context"
"time"
"git.kumo.work/shama/service/client"
bean2 "git.kumo.work/shama/service/erp/bean"
product2 "git.kumo.work/shama/service/erp/product"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
"time"
)
type product struct {
@ -281,6 +282,7 @@ type ReplyProductInfo struct {
Quote ProductQuoteInfo `json:"quote"`
Children []ReplyProductInfo `json:"children"`
CreatedStaffId int64 `json:"createdStaffId"`
PurchaseProducts []PurchaseProduct `json:"purchaseProducts"`
}
type ProductPackageInfo struct {
@ -311,6 +313,23 @@ type ProductQuoteInfo struct {
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
type PurchaseProduct struct {
Id int64 `json:"id"`
PurchaseId int64 `json:"purchaseId"`
PiSerial string `json:"piSerial"`
PoSerial string `json:"poSerial"`
BatchNo int64 `json:"batchNo"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
DeliveryDate *time.Time `json:"deliveryDate"`
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
PurchaseCount int64 `json:"purchaseCount"`
PurchasePrice decimal.Decimal `json:"purchasePrice"`
ShipmentCount int64 `json:"shipmentCount"`
ShippedCount int64 `json:"shippedCount"`
AccountingCount int64 `json:"accountingCount"`
AccountedCount int64 `json:"accountedCount"`
}
// Info @TITLE 产品详情
func (p *product) Info(ctx context.Context, saleProductId int64) (reply ReplyProductInfo, err error) {

View File

@ -87,6 +87,29 @@ type SaleProductItem struct {
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Children []*SaleProductItem `json:"children"`
PurchaseProducts []PurchaseProductItem `json:"purchaseProducts"`
}
type PurchaseProductItem struct {
ShipmentPurchaseProductId int64 `json:"shipmentPurchaseProductId"`
ShipmentCount int64 `json:"shipmentCount"`
PurchaseProduct PurchaseProductInfo `json:"purchaseProduct"`
}
type PurchaseProductInfo struct {
Id int64 `json:"id"`
PurchaseId int64 `json:"purchaseId"`
PiSerial string `json:"piSerial"`
PoSerial string `json:"poSerial"`
BatchNo int64 `json:"batchNo"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
DeliveryDate *time.Time `json:"deliveryDate"`
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
PurchaseCount int64 `json:"purchaseCount"`
PurchasePrice decimal.Decimal `json:"purchasePrice"`
ShipmentCount int64 `json:"shipmentCount"`
ShippedCount int64 `json:"shippedCount"`
AccountingCount int64 `json:"accountingCount"`
AccountedCount int64 `json:"accountedCount"`
}
type ArgsSaleProductSearch struct {
ModifyId int64 // 订舱单修改id
@ -157,6 +180,11 @@ type SaleProductAdd struct {
RemarkImg string // 图片备注
ContainerNumber string // 箱号
SealNumber string // 封号
PurchaseProducts []PurchaseProduct // 采购商品
}
type PurchaseProduct struct {
PurchaseProductId int64 // 采购商品id
ShipmentCount int64 // 出运数量
}
// Add @TITLE 添加
@ -228,6 +256,7 @@ type SaleProductEdit struct {
RemarkImg string // 图片备注
ContainerNumber string // 箱号
SealNumber string // 封号
PurchaseProducts []PurchaseProduct // 采购商品
}
// Edit @TITLE 编辑

View File

@ -2,9 +2,10 @@ package shipment
import (
"context"
"time"
"git.kumo.work/shama/service/client"
"github.com/shopspring/decimal"
"time"
)
type saleProduct struct {
@ -87,6 +88,30 @@ type SaleProductItem struct {
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Children []*SaleProductItem `json:"children"`
PurchaseProducts []PurchaseProductItem `json:"purchaseProducts"`
}
type PurchaseProductItem struct {
ShipmentPurchaseProductId int64 `json:"shipmentPurchaseProductId"`
ShipmentCount int64 `json:"shipmentCount"`
PurchaseProduct PurchaseProductInfo `json:"purchaseProduct"`
}
type PurchaseProductInfo struct {
Id int64 `json:"id"`
PurchaseId int64 `json:"purchaseId"`
PiSerial string `json:"piSerial"`
PoSerial string `json:"poSerial"`
BatchNo int64 `json:"batchNo"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
DeliveryDate *time.Time `json:"deliveryDate"`
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
PurchaseCount int64 `json:"purchaseCount"`
PurchasePrice decimal.Decimal `json:"purchasePrice"`
ShipmentCount int64 `json:"shipmentCount"`
ShippedCount int64 `json:"shippedCount"`
AccountingCount int64 `json:"accountingCount"`
AccountedCount int64 `json:"accountedCount"`
}
type ArgsSaleProductSearch struct {
ShipmentId int64 // 出舱单
@ -158,6 +183,11 @@ type SaleProductAdd struct {
RemarkImg string // 图片备注
ContainerNumber string // 箱号
SealNumber string // 封号
PurchaseProducts []PurchaseProduct // 采购商品
}
type PurchaseProduct struct {
PurchaseProductId int64 // 采购商品id
ShipmentCount int64 // 出运数量
}
// Add @TITLE 添加
@ -229,6 +259,7 @@ type SaleProductEdit struct {
RemarkImg string // 图片备注
ContainerNumber string // 箱号
SealNumber string // 封号
PurchaseProducts []PurchaseProduct // 采购商品
}
// Edit @TITLE 编辑