104 lines
3.1 KiB
Go
104 lines
3.1 KiB
Go
|
package shipment
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"git.kumo.work/shama/service/client"
|
||
|
"github.com/shopspring/decimal"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type gift struct {
|
||
|
}
|
||
|
|
||
|
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"`
|
||
|
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"`
|
||
|
Remark string `json:"remark"`
|
||
|
Sort int64 `json:"sort"`
|
||
|
CreatedAt *time.Time `json:"createdAt"`
|
||
|
}
|
||
|
|
||
|
// All @TITLE 全部赠品
|
||
|
func (g *gift) All(ctx context.Context, shipmentId int64) (reply []GiftItem, err error) {
|
||
|
xClient, err := client.GetClient(g)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
err = xClient.Call(ctx, "All", shipmentId, &reply)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
type ArgsGiftAdd struct {
|
||
|
ShipmentId int64 // 订舱单ID
|
||
|
GiftAdd
|
||
|
}
|
||
|
|
||
|
type GiftAdd struct {
|
||
|
Name string // 中文品名
|
||
|
EngName string // 英文品名
|
||
|
CustomsName string // 中文报关名称
|
||
|
CustomsSerial string // 海关编码
|
||
|
CustomsMeasureUnit string // 报关单位
|
||
|
CustomsInvoiceUnit string // 开票单位
|
||
|
CustomsDetail string // 申报要素
|
||
|
ShipmentCount int64 // 出运数量
|
||
|
OuterBoxCount int64 // 箱数
|
||
|
TotalVolume decimal.Decimal // 总体积
|
||
|
TotalGrossWeight decimal.Decimal // 总毛重
|
||
|
TotalNetWeight decimal.Decimal // 总净重
|
||
|
CustomsPrice decimal.Decimal // 报关单价
|
||
|
CustomsAmount decimal.Decimal // 报关总价
|
||
|
DomesticSupply 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 GiftEdit struct {
|
||
|
GiftId int64 // 费用ID
|
||
|
GiftAdd
|
||
|
}
|
||
|
|
||
|
// Edit @TITLE 编辑赠品
|
||
|
func (g *gift) Edit(ctx context.Context, args []GiftEdit) (err error) {
|
||
|
xClient, err := client.GetClient(g)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||
|
}
|
||
|
|
||
|
// Delete @TITLE 删除赠品
|
||
|
func (g *gift) Delete(ctx context.Context, giftIds []int64) (err error) {
|
||
|
xClient, err := client.GetClient(g)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Delete", giftIds, &reply)
|
||
|
}
|