refactor(erp):优化销售产品结构并调整采购产品引用

- 移除 PurchaseProductInfo 结构体定义- 更新 PurchaseProductItem 结构体字段- 在 SaleProductItem 中新增 ShipmentPurchaseProducts 字段
- 修改 PurchaseProducts 字段类型为 sale2.PurchaseProduct
- 引入 sale2 包以支持新的数据结构引用
This commit is contained in:
守护自己的云 2025-09-29 11:40:47 +08:00
parent 0593a556e4
commit 49e1b5050d
2 changed files with 161 additions and 193 deletions

View File

@ -5,6 +5,7 @@ import (
"time" "time"
"git.kumo.work/shama/service/client" "git.kumo.work/shama/service/client"
sale2 "git.kumo.work/shama/service/erp/sale"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
) )
@ -12,104 +13,87 @@ type saleProduct struct {
} }
type SaleProductItem struct { type SaleProductItem struct {
Id int64 `json:"id"` Id int64 `json:"id"`
Mold int64 `json:"mold"` Mold int64 `json:"mold"`
ParentSaleProductId int64 `json:"parentSaleProductId"` ParentSaleProductId int64 `json:"parentSaleProductId"`
SaleProductId int64 `json:"saleProductId"` SaleProductId int64 `json:"saleProductId"`
PiSerial string `json:"piSerial"` PiSerial string `json:"piSerial"`
Sort int64 `json:"sort"` Sort int64 `json:"sort"`
Po string `json:"po"` Po string `json:"po"`
Serial string `json:"serial"` Serial string `json:"serial"`
ImgFilePaths []string `json:"imgFilePaths"` ImgFilePaths []string `json:"imgFilePaths"`
CustomSerial string `json:"customSerial"` CustomSerial string `json:"customSerial"`
PackageDescription string `json:"packageDescription"` PackageDescription string `json:"packageDescription"`
PackageEngDescription string `json:"packageEngDescription"` PackageEngDescription string `json:"packageEngDescription"`
PackageWeight decimal.Decimal `json:"packageWeight"` PackageWeight decimal.Decimal `json:"packageWeight"`
EngName string `json:"engName"` EngName string `json:"engName"`
Name string `json:"name"` Name string `json:"name"`
CustomsName string `json:"customsName"` CustomsName string `json:"customsName"`
CustomsSerial string `json:"customsSerial"` CustomsSerial string `json:"customsSerial"`
CustomsMeasureUnit string `json:"customsMeasureUnit"` CustomsMeasureUnit string `json:"customsMeasureUnit"`
CustomsInvoiceUnit string `json:"customsInvoiceUnit"` CustomsInvoiceUnit string `json:"customsInvoiceUnit"`
CustomsDetail string `json:"customsDetail"` CustomsDetail string `json:"customsDetail"`
BlEngName string `json:"blEngName"` BlEngName string `json:"blEngName"`
BoxCount int64 `json:"boxCount"` BoxCount int64 `json:"boxCount"`
InnerNum int64 `json:"innerNum"` InnerNum int64 `json:"innerNum"`
InnerBoxCount *int64 `json:"innerBoxCount"` InnerBoxCount *int64 `json:"innerBoxCount"`
BoxNumUnit string `json:"boxNumUnit"` BoxNumUnit string `json:"boxNumUnit"`
OuterNum int64 `json:"outerNum"` OuterNum int64 `json:"outerNum"`
ShipmentCount int64 `json:"shipmentCount"` ShipmentCount int64 `json:"shipmentCount"`
ShipmentCountUnit string `json:"shipmentCountUnit"` ShipmentCountUnit string `json:"shipmentCountUnit"`
Length decimal.Decimal `json:"length"` Length decimal.Decimal `json:"length"`
Width decimal.Decimal `json:"width"` Width decimal.Decimal `json:"width"`
Height decimal.Decimal `json:"height"` Height decimal.Decimal `json:"height"`
Volume decimal.Decimal `json:"volume"` Volume decimal.Decimal `json:"volume"`
TotalVolume decimal.Decimal `json:"totalVolume"` TotalVolume decimal.Decimal `json:"totalVolume"`
NetGrossVolume int64 `json:"netGrossVolume"` NetGrossVolume int64 `json:"netGrossVolume"`
GrossWeight decimal.Decimal `json:"grossWeight"` GrossWeight decimal.Decimal `json:"grossWeight"`
TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"`
NetWeight decimal.Decimal `json:"netWeight"` NetWeight decimal.Decimal `json:"netWeight"`
TotalNetWeight decimal.Decimal `json:"totalNetWeight"` TotalNetWeight decimal.Decimal `json:"totalNetWeight"`
CustomsVolume decimal.Decimal `json:"customsVolume"` CustomsVolume decimal.Decimal `json:"customsVolume"`
TotalCustomsVolume decimal.Decimal `json:"totalCustomsVolume"` TotalCustomsVolume decimal.Decimal `json:"totalCustomsVolume"`
CustomsNetWeight decimal.Decimal `json:"customsNetWeight"` CustomsNetWeight decimal.Decimal `json:"customsNetWeight"`
TotalCustomsNetWeight decimal.Decimal `json:"totalCustomsNetWeight"` TotalCustomsNetWeight decimal.Decimal `json:"totalCustomsNetWeight"`
CustomsGrossWeight decimal.Decimal `json:"customsGrossWeight"` CustomsGrossWeight decimal.Decimal `json:"customsGrossWeight"`
TotalCustomsGrossWeight decimal.Decimal `json:"totalCustomsGrossWeight"` TotalCustomsGrossWeight decimal.Decimal `json:"totalCustomsGrossWeight"`
SalePrice decimal.Decimal `json:"salePrice"` SalePrice decimal.Decimal `json:"salePrice"`
SaleAmount decimal.Decimal `json:"saleAmount"` SaleAmount decimal.Decimal `json:"saleAmount"`
CustomsPrice decimal.Decimal `json:"customsPrice"` CustomsPrice decimal.Decimal `json:"customsPrice"`
CustomsAmount decimal.Decimal `json:"customsAmount"` CustomsAmount decimal.Decimal `json:"customsAmount"`
FactoryName string `json:"factoryName"` FactoryName string `json:"factoryName"`
CurrencyRate decimal.Decimal `json:"currencyRate"` CurrencyRate decimal.Decimal `json:"currencyRate"`
Brand string `json:"brand"` Brand string `json:"brand"`
DomesticSupply string `json:"domesticSupply"` DomesticSupply string `json:"domesticSupply"`
EpmNo string `json:"epmNo"` EpmNo string `json:"epmNo"`
HsSerial int64 `json:"hsSerial"` HsSerial int64 `json:"hsSerial"`
TaxExemption string `json:"taxExemption"` TaxExemption string `json:"taxExemption"`
ItemNumber string `json:"itemNumber"` ItemNumber string `json:"itemNumber"`
Texture string `json:"texture"` Texture string `json:"texture"`
EngTexture string `json:"engTexture"` EngTexture string `json:"engTexture"`
Remark1 string `json:"remark1"` Remark1 string `json:"remark1"`
Remark2 string `json:"remark2"` Remark2 string `json:"remark2"`
Remark3 string `json:"remark3"` Remark3 string `json:"remark3"`
Remark4 string `json:"remark4"` Remark4 string `json:"remark4"`
Remark5 string `json:"remark5"` Remark5 string `json:"remark5"`
Remark6 string `json:"remark6"` Remark6 string `json:"remark6"`
ExchangeSettlementRemark string `json:"exchangeSettlementRemark"` ExchangeSettlementRemark string `json:"exchangeSettlementRemark"`
RemarkImg string `json:"remarkImg"` RemarkImg string `json:"remarkImg"`
ContainerNumber string `json:"containerNumber"` ContainerNumber string `json:"containerNumber"`
SealNumber string `json:"sealNumber"` SealNumber string `json:"sealNumber"`
PurchasePrice decimal.Decimal `json:"purchasePrice"` PurchasePrice decimal.Decimal `json:"purchasePrice"`
PurchaseAmount decimal.Decimal `json:"purchaseAmount"` PurchaseAmount decimal.Decimal `json:"purchaseAmount"`
IsSerial int64 `json:"isSerial"` IsSerial int64 `json:"isSerial"`
IsCustoms int64 `json:"isCustoms"` IsCustoms int64 `json:"isCustoms"`
CreatedAt *time.Time `json:"createdAt"` CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"` UpdatedAt *time.Time `json:"updatedAt"`
Children []*SaleProductItem `json:"children"` Children []*SaleProductItem `json:"children"`
PurchaseProducts []PurchaseProductItem `json:"purchaseProducts"` ShipmentPurchaseProducts []PurchaseProductItem `json:"shipmentPurchaseProducts"`
PurchaseProducts []sale2.PurchaseProduct `json:"purchaseProducts"`
} }
type PurchaseProductItem struct { type PurchaseProductItem struct {
ShipmentPurchaseProductId int64 `json:"shipmentPurchaseProductId"` ShipmentPurchaseProductId int64 `json:"shipmentPurchaseProductId"`
ShipmentCount int64 `json:"shipmentCount"` 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 { type ArgsSaleProductSearch struct {
ModifyId int64 // 订舱单修改id ModifyId int64 // 订舱单修改id

View File

@ -5,6 +5,7 @@ import (
"time" "time"
"git.kumo.work/shama/service/client" "git.kumo.work/shama/service/client"
sale2 "git.kumo.work/shama/service/erp/sale"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
) )
@ -12,106 +13,89 @@ type saleProduct struct {
} }
type SaleProductItem struct { type SaleProductItem struct {
Id int64 `json:"id"` Id int64 `json:"id"`
Mold int64 `json:"mold"` Mold int64 `json:"mold"`
ParentSaleProductId int64 `json:"parentSaleProductId"` ParentSaleProductId int64 `json:"parentSaleProductId"`
SaleProductId int64 `json:"saleProductId"` SaleProductId int64 `json:"saleProductId"`
PiSerial string `json:"piSerial"` PiSerial string `json:"piSerial"`
Sort int64 `json:"sort"` Sort int64 `json:"sort"`
Po string `json:"po"` Po string `json:"po"`
Serial string `json:"serial"` Serial string `json:"serial"`
ImgFilePaths []string `json:"imgFilePaths"` ImgFilePaths []string `json:"imgFilePaths"`
CustomSerial string `json:"customSerial"` CustomSerial string `json:"customSerial"`
PackageDescription string `json:"packageDescription"` PackageDescription string `json:"packageDescription"`
PackageEngDescription string `json:"packageEngDescription"` PackageEngDescription string `json:"packageEngDescription"`
PackageWeight decimal.Decimal `json:"packageWeight"` PackageWeight decimal.Decimal `json:"packageWeight"`
EngName string `json:"engName"` EngName string `json:"engName"`
Name string `json:"name"` Name string `json:"name"`
CustomsName string `json:"customsName"` CustomsName string `json:"customsName"`
CustomsSerial string `json:"customsSerial"` CustomsSerial string `json:"customsSerial"`
CustomsMeasureUnit string `json:"customsMeasureUnit"` CustomsMeasureUnit string `json:"customsMeasureUnit"`
CustomsInvoiceUnit string `json:"customsInvoiceUnit"` CustomsInvoiceUnit string `json:"customsInvoiceUnit"`
CustomsDetail string `json:"customsDetail"` CustomsDetail string `json:"customsDetail"`
BlEngName string `json:"blEngName"` BlEngName string `json:"blEngName"`
BoxCount int64 `json:"boxCount"` BoxCount int64 `json:"boxCount"`
InnerNum int64 `json:"innerNum"` InnerNum int64 `json:"innerNum"`
InnerBoxCount *int64 `json:"innerBoxCount"` InnerBoxCount *int64 `json:"innerBoxCount"`
BoxNumUnit string `json:"boxNumUnit"` BoxNumUnit string `json:"boxNumUnit"`
OuterNum int64 `json:"outerNum"` OuterNum int64 `json:"outerNum"`
ShipmentCount int64 `json:"shipmentCount"` ShipmentCount int64 `json:"shipmentCount"`
ShipmentCountUnit string `json:"shipmentCountUnit"` ShipmentCountUnit string `json:"shipmentCountUnit"`
Length decimal.Decimal `json:"length"` Length decimal.Decimal `json:"length"`
Width decimal.Decimal `json:"width"` Width decimal.Decimal `json:"width"`
Height decimal.Decimal `json:"height"` Height decimal.Decimal `json:"height"`
Volume decimal.Decimal `json:"volume"` Volume decimal.Decimal `json:"volume"`
TotalVolume decimal.Decimal `json:"totalVolume"` TotalVolume decimal.Decimal `json:"totalVolume"`
NetGrossVolume int64 `json:"netGrossVolume"` NetGrossVolume int64 `json:"netGrossVolume"`
GrossWeight decimal.Decimal `json:"grossWeight"` GrossWeight decimal.Decimal `json:"grossWeight"`
TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"`
NetWeight decimal.Decimal `json:"netWeight"` NetWeight decimal.Decimal `json:"netWeight"`
TotalNetWeight decimal.Decimal `json:"totalNetWeight"` TotalNetWeight decimal.Decimal `json:"totalNetWeight"`
CustomsVolume decimal.Decimal `json:"customsVolume"` CustomsVolume decimal.Decimal `json:"customsVolume"`
TotalCustomsVolume decimal.Decimal `json:"totalCustomsVolume"` TotalCustomsVolume decimal.Decimal `json:"totalCustomsVolume"`
CustomsNetWeight decimal.Decimal `json:"customsNetWeight"` CustomsNetWeight decimal.Decimal `json:"customsNetWeight"`
TotalCustomsNetWeight decimal.Decimal `json:"totalCustomsNetWeight"` TotalCustomsNetWeight decimal.Decimal `json:"totalCustomsNetWeight"`
CustomsGrossWeight decimal.Decimal `json:"customsGrossWeight"` CustomsGrossWeight decimal.Decimal `json:"customsGrossWeight"`
TotalCustomsGrossWeight decimal.Decimal `json:"totalCustomsGrossWeight"` TotalCustomsGrossWeight decimal.Decimal `json:"totalCustomsGrossWeight"`
SalePrice decimal.Decimal `json:"salePrice"` SalePrice decimal.Decimal `json:"salePrice"`
SaleAmount decimal.Decimal `json:"saleAmount"` SaleAmount decimal.Decimal `json:"saleAmount"`
CustomsPrice decimal.Decimal `json:"customsPrice"` CustomsPrice decimal.Decimal `json:"customsPrice"`
CustomsAmount decimal.Decimal `json:"customsAmount"` CustomsAmount decimal.Decimal `json:"customsAmount"`
FactoryName string `json:"factoryName"` FactoryName string `json:"factoryName"`
CurrencyRate decimal.Decimal `json:"currencyRate"` CurrencyRate decimal.Decimal `json:"currencyRate"`
Brand string `json:"brand"` Brand string `json:"brand"`
DomesticSupply string `json:"domesticSupply"` DomesticSupply string `json:"domesticSupply"`
EpmNo string `json:"epmNo"` EpmNo string `json:"epmNo"`
HsSerial int64 `json:"hsSerial"` HsSerial int64 `json:"hsSerial"`
TaxExemption string `json:"taxExemption"` TaxExemption string `json:"taxExemption"`
ItemNumber string `json:"itemNumber"` ItemNumber string `json:"itemNumber"`
Texture string `json:"texture"` Texture string `json:"texture"`
EngTexture string `json:"engTexture"` EngTexture string `json:"engTexture"`
Remark1 string `json:"remark1"` Remark1 string `json:"remark1"`
Remark2 string `json:"remark2"` Remark2 string `json:"remark2"`
Remark3 string `json:"remark3"` Remark3 string `json:"remark3"`
Remark4 string `json:"remark4"` Remark4 string `json:"remark4"`
Remark5 string `json:"remark5"` Remark5 string `json:"remark5"`
Remark6 string `json:"remark6"` Remark6 string `json:"remark6"`
ExchangeSettlementRemark string `json:"exchangeSettlementRemark"` ExchangeSettlementRemark string `json:"exchangeSettlementRemark"`
RemarkImg string `json:"remarkImg"` RemarkImg string `json:"remarkImg"`
ContainerNumber string `json:"containerNumber"` ContainerNumber string `json:"containerNumber"`
SealNumber string `json:"sealNumber"` SealNumber string `json:"sealNumber"`
PurchasePrice decimal.Decimal `json:"purchasePrice"` PurchasePrice decimal.Decimal `json:"purchasePrice"`
PurchaseAmount decimal.Decimal `json:"purchaseAmount"` PurchaseAmount decimal.Decimal `json:"purchaseAmount"`
IsSerial int64 `json:"isSerial"` IsSerial int64 `json:"isSerial"`
IsCustoms int64 `json:"isCustoms"` IsCustoms int64 `json:"isCustoms"`
IsExchangeSettlement int64 `json:"isExchangeSettlement"` IsExchangeSettlement int64 `json:"isExchangeSettlement"`
CreatedAt *time.Time `json:"createdAt"` CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"` UpdatedAt *time.Time `json:"updatedAt"`
Children []*SaleProductItem `json:"children"` Children []*SaleProductItem `json:"children"`
PurchaseProducts []PurchaseProductItem `json:"purchaseProducts"` ShipmentPurchaseProducts []PurchaseProductItem `json:"shipmentPurchaseProducts"`
PurchaseProducts []sale2.PurchaseProduct `json:"purchaseProducts"`
} }
type PurchaseProductItem struct { type PurchaseProductItem struct {
ShipmentPurchaseProductId int64 `json:"shipmentPurchaseProductId"` ShipmentPurchaseProductId int64 `json:"shipmentPurchaseProductId"`
ShipmentCount int64 `json:"shipmentCount"` 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 { type ArgsSaleProductSearch struct {
ShipmentId int64 // 出舱单 ShipmentId int64 // 出舱单