service/erp/shipment/gift.go
2024-09-23 15:37:04 +08:00

119 lines
3.6 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"`
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"`
ContainerNumber string `json:"containerNumber"`
SealNumber string `json:"sealNumber"`
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
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 // 境内货源地
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)
}