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

View File

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