161 lines
5.8 KiB
Go
161 lines
5.8 KiB
Go
package shipment
|
|
|
|
import (
|
|
"context"
|
|
"git.kumo.work/shama/service/client"
|
|
"github.com/shopspring/decimal"
|
|
"time"
|
|
)
|
|
|
|
type saleProduct struct {
|
|
}
|
|
|
|
type SaleProductItem struct {
|
|
Id int64 `json:"id"`
|
|
PiSerial string `json:"piSerial"`
|
|
Sort int64 `json:"sort"`
|
|
Po string `json:"po"`
|
|
Serial string `json:"serial"`
|
|
CustomSerial string `json:"customSerial"`
|
|
PackageDescription string `json:"packageDescription"`
|
|
PackageEngDescription string `json:"packageEngDescription"`
|
|
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"`
|
|
SalePrice decimal.Decimal `json:"salePrice"`
|
|
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"`
|
|
Remark1 string `json:"remark1"`
|
|
Remark2 string `json:"remark2"`
|
|
Remark3 string `json:"remark3"`
|
|
Remark4 string `json:"remark4"`
|
|
Remark5 string `json:"remark5"`
|
|
Remark6 string `json:"remark6"`
|
|
ContainerNumber string `json:"containerNumber"`
|
|
SealNumber string `json:"sealNumber"`
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
UpdatedAt *time.Time `json:"updatedAt"`
|
|
}
|
|
type ArgsSaleProductSearch struct {
|
|
ShipmentId int64 // 出舱单
|
|
SaleIds []int64 // 销售合同
|
|
PiSerial string // pi号
|
|
}
|
|
|
|
// All @TITLE 获取商品
|
|
func (s *saleProduct) All(ctx context.Context, search ArgsSaleProductSearch) (reply []SaleProductItem, err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "All", search, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsSaleProductAdd struct {
|
|
ShipmentId int64 // 出舱单id
|
|
Products []SaleProductAdd // 产品信息
|
|
}
|
|
type SaleProductAdd struct {
|
|
SaleProductId int64 // 销售商品id
|
|
ShipmentCount int64 // 出运数量
|
|
NetGrossVolume int64 // 净毛体计算类型 1=内盒 2=外箱
|
|
EpmNo string // EPM NO
|
|
TaxExemption string // 免征税
|
|
ItemNumber string // 项号
|
|
Remark1 string // 备注1
|
|
Remark2 string // 备注2
|
|
Remark3 string // 备注3
|
|
Remark4 string // 备注4
|
|
Remark5 string // 备注5
|
|
Remark6 string // 备注6
|
|
ContainerNumber string // 箱号
|
|
SealNumber string // 封号
|
|
}
|
|
|
|
// Add @TITLE 添加
|
|
func (s *saleProduct) Add(ctx context.Context, args ArgsSaleProductAdd) (err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Add", args, &reply)
|
|
}
|
|
|
|
type ArgsSaleProductEdit struct {
|
|
ShipmentSaleProductId int64
|
|
Product SaleProductEdit
|
|
}
|
|
type SaleProductEdit struct {
|
|
SaleProductId int64 // 销售商品id
|
|
ShipmentCount int64 // 出运数量
|
|
NetGrossVolume int64 // 净毛体计算类型 1=内盒 2=外箱
|
|
EpmNo string // EPM NO
|
|
TaxExemption string // 免征税
|
|
ItemNumber string // 项号
|
|
Remark1 string // 备注1
|
|
Remark2 string // 备注2
|
|
Remark3 string // 备注3
|
|
Remark4 string // 备注4
|
|
Remark5 string // 备注5
|
|
Remark6 string // 备注6
|
|
ContainerNumber string // 箱号
|
|
SealNumber string // 封号
|
|
Sort int64 // 排序
|
|
BlEngName string // 提单英文名
|
|
}
|
|
|
|
// Edit @TITLE 编辑
|
|
func (s *saleProduct) Edit(ctx context.Context, args ArgsSaleProductEdit) (err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
}
|
|
|
|
type ArgsSaleProductDelete struct {
|
|
ShipmentId int64 // 订舱单id
|
|
ShipmentSaleProductIds []int64 // 出运参评id
|
|
}
|
|
|
|
// Delete @TITLE 删除出运产品
|
|
func (s *saleProduct) Delete(ctx context.Context, args ArgsSaleProductDelete) (err error) {
|
|
xClient, err := client.GetClient(s)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Delete", args, &reply)
|
|
}
|