128 lines
4.0 KiB
Go
128 lines
4.0 KiB
Go
package shipment
|
|
|
|
import (
|
|
"context"
|
|
"git.kumo.work/shama/service/client"
|
|
"github.com/shopspring/decimal"
|
|
"time"
|
|
)
|
|
|
|
type gift struct {
|
|
}
|
|
|
|
type ArgsGiftSearch struct {
|
|
ShipmentId int64 // 出舱单
|
|
ShipmentGiftIds []int64 // 出舱单赠品id
|
|
}
|
|
|
|
type GiftItem struct {
|
|
Id int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
EngName string `json:"engName"`
|
|
CustomsName string `json:"customsName"`
|
|
CustomsSerial string `json:"customsSerial"`
|
|
CustomsMeasureUnit string `json:"customsMeasureUnit"`
|
|
CustomsInvoiceUnit string `json:"customsInvoiceUnit"`
|
|
CustomsDetail string `json:"customsDetail"`
|
|
ShipmentCount int64 `json:"shipmentCount"`
|
|
ShipmentCountUnit string `json:"shipmentCountUnit"`
|
|
OuterBoxCount int64 `json:"outerBoxCount"`
|
|
TotalVolume decimal.Decimal `json:"totalVolume"`
|
|
TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"`
|
|
TotalNetWeight decimal.Decimal `json:"totalNetWeight"`
|
|
CustomsPrice decimal.Decimal `json:"customsPrice"`
|
|
CustomsAmount decimal.Decimal `json:"customsAmount"`
|
|
DomesticSupply string `json:"domesticSupply"`
|
|
TaxExemption string `json:"taxExemption"`
|
|
ContainerNumber string `json:"containerNumber"`
|
|
SealNumber string `json:"sealNumber"`
|
|
Remark string `json:"remark"`
|
|
Sort int64 `json:"sort"`
|
|
IsSerial int64 `json:"isSerial"`
|
|
IsCustoms int64 `json:"isCustoms"`
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
}
|
|
|
|
// All @TITLE 全部赠品
|
|
func (g *gift) All(ctx context.Context, args ArgsGiftSearch) (reply []GiftItem, err error) {
|
|
xClient, err := client.GetClient(g)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "All", args, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsGiftAdd struct {
|
|
ShipmentId int64 // 订舱单ID
|
|
Gifts []GiftAdd
|
|
}
|
|
|
|
type GiftAdd struct {
|
|
Name string // 中文品名
|
|
EngName string // 英文品名
|
|
CustomsName string // 中文报关名称
|
|
CustomsSerial string // 海关编码
|
|
CustomsMeasureUnit string // 报关单位
|
|
CustomsInvoiceUnit string // 开票单位
|
|
CustomsDetail string // 申报要素
|
|
ShipmentCount int64 // 出运数量
|
|
ShipmentCountUnit string // 数量单位
|
|
OuterBoxCount int64 // 箱数
|
|
TotalVolume decimal.Decimal // 体积
|
|
TotalGrossWeight decimal.Decimal // 毛重
|
|
TotalNetWeight decimal.Decimal // 净重
|
|
CustomsPrice decimal.Decimal // 报关单价
|
|
CustomsAmount decimal.Decimal // 报关总价
|
|
DomesticSupply string // 境内货源地
|
|
TaxExemption string // 征免
|
|
ContainerNumber string // 箱号
|
|
SealNumber string // 封号
|
|
Remark string // 备注
|
|
Sort int64 // 排序
|
|
}
|
|
|
|
// Add @TITLE 添加赠品
|
|
func (g *gift) Add(ctx context.Context, args ArgsGiftAdd) (err error) {
|
|
xClient, err := client.GetClient(g)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Add", args, &reply)
|
|
}
|
|
|
|
type ArgsGiftEdit struct {
|
|
ShipmentId int64 // 订舱单ID
|
|
Gifts []GiftEdit
|
|
}
|
|
type GiftEdit struct {
|
|
GiftId int64 // 费用ID
|
|
GiftAdd
|
|
}
|
|
|
|
// Edit @TITLE 编辑赠品
|
|
func (g *gift) Edit(ctx context.Context, args ArgsGiftEdit) (err error) {
|
|
xClient, err := client.GetClient(g)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
}
|
|
|
|
type ArgsGiftDelete struct {
|
|
ShipmentId int64 // 订舱单ID
|
|
GiftIds []int64 // 赠品id
|
|
}
|
|
|
|
// Delete @TITLE 删除赠品
|
|
func (g *gift) Delete(ctx context.Context, args ArgsGiftDelete) (err error) {
|
|
xClient, err := client.GetClient(g)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Delete", args, &reply)
|
|
}
|