service/erp/shipment/gift.go

128 lines
4.0 KiB
Go
Raw Normal View History

2024-09-20 14:51:43 +08:00
package shipment
import (
"context"
"git.kumo.work/shama/service/client"
"github.com/shopspring/decimal"
"time"
)
type gift struct {
}
2024-10-11 11:12:44 +08:00
type ArgsGiftSearch struct {
ShipmentId int64 // 出舱单
ShipmentGiftIds []int64 // 出舱单赠品id
}
2024-09-20 14:51:43 +08:00
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"`
2024-09-20 16:29:41 +08:00
ShipmentCountUnit string `json:"shipmentCountUnit"`
2024-09-20 14:51:43 +08:00
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"`
2024-10-31 14:05:49 +08:00
TaxExemption string `json:"taxExemption"`
2024-09-20 16:29:41 +08:00
ContainerNumber string `json:"containerNumber"`
SealNumber string `json:"sealNumber"`
2024-09-20 14:51:43 +08:00
Remark string `json:"remark"`
Sort int64 `json:"sort"`
2024-10-11 11:12:44 +08:00
IsSerial int64 `json:"isSerial"`
IsCustoms int64 `json:"isCustoms"`
2024-09-20 14:51:43 +08:00
CreatedAt *time.Time `json:"createdAt"`
}
// All @TITLE 全部赠品
2024-10-11 11:12:44 +08:00
func (g *gift) All(ctx context.Context, args ArgsGiftSearch) (reply []GiftItem, err error) {
2024-09-20 14:51:43 +08:00
xClient, err := client.GetClient(g)
if err != nil {
return
}
2024-10-11 11:12:44 +08:00
err = xClient.Call(ctx, "All", args, &reply)
2024-09-20 14:51:43 +08:00
return
}
type ArgsGiftAdd struct {
ShipmentId int64 // 订舱单ID
2024-09-20 15:24:15 +08:00
Gifts []GiftAdd
2024-09-20 14:51:43 +08:00
}
type GiftAdd struct {
Name string // 中文品名
EngName string // 英文品名
CustomsName string // 中文报关名称
CustomsSerial string // 海关编码
CustomsMeasureUnit string // 报关单位
CustomsInvoiceUnit string // 开票单位
CustomsDetail string // 申报要素
ShipmentCount int64 // 出运数量
2024-09-20 16:29:41 +08:00
ShipmentCountUnit string // 数量单位
2024-09-20 14:51:43 +08:00
OuterBoxCount int64 // 箱数
2024-09-20 15:24:15 +08:00
TotalVolume decimal.Decimal // 体积
TotalGrossWeight decimal.Decimal // 毛重
TotalNetWeight decimal.Decimal // 净重
2024-09-20 14:51:43 +08:00
CustomsPrice decimal.Decimal // 报关单价
CustomsAmount decimal.Decimal // 报关总价
DomesticSupply string // 境内货源地
2024-10-31 14:05:49 +08:00
TaxExemption string // 征免
2024-09-20 16:29:41 +08:00
ContainerNumber string // 箱号
SealNumber string // 封号
2024-09-20 14:51:43 +08:00
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)
}
2024-09-23 15:37:04 +08:00
type ArgsGiftEdit struct {
ShipmentId int64 // 订舱单ID
Gifts []GiftEdit
}
2024-09-20 14:51:43 +08:00
type GiftEdit struct {
GiftId int64 // 费用ID
GiftAdd
}
// Edit @TITLE 编辑赠品
2024-09-23 15:37:04 +08:00
func (g *gift) Edit(ctx context.Context, args ArgsGiftEdit) (err error) {
2024-09-20 14:51:43 +08:00
xClient, err := client.GetClient(g)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
2024-09-23 15:37:04 +08:00
type ArgsGiftDelete struct {
ShipmentId int64 // 订舱单ID
GiftIds []int64 // 赠品id
}
2024-09-20 14:51:43 +08:00
// Delete @TITLE 删除赠品
2024-09-23 15:37:04 +08:00
func (g *gift) Delete(ctx context.Context, args ArgsGiftDelete) (err error) {
2024-09-20 14:51:43 +08:00
xClient, err := client.GetClient(g)
if err != nil {
return
}
reply := 0
2024-09-23 15:37:04 +08:00
return xClient.Call(ctx, "Delete", args, &reply)
2024-09-20 14:51:43 +08:00
}