service/erp/shipment/customsCost.go

78 lines
1.8 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 customsCost struct {
}
type CustomsCostItem struct {
Id int64 `json:"id"`
Name string `json:"name"`
2024-09-23 15:37:04 +08:00
Type int64 `json:"type"`
2024-09-20 14:51:43 +08:00
Amount decimal.Decimal `json:"amount"`
Remarks string `json:"remarks"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取费用
func (c *customsCost) All(ctx context.Context, purchaseId int64) (reply []CustomsCostItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsCustomsCostAdd struct {
ShipmentId int64 // 订舱单ID
CustomsCostAdd
}
type CustomsCostAdd struct {
Name string // 费用名
Amount decimal.Decimal // 金额
Remarks string // 备注信息
}
// Add @TITLE 添加费用
func (c *customsCost) Add(ctx context.Context, args ArgsCustomsCostAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsCustomsCostEdit struct {
CustomsCostId int64 // 费用ID
CustomsCostAdd
}
// Edit @TITLE 编辑费用
func (c *customsCost) Edit(ctx context.Context, args ArgsCustomsCostEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除费用
func (c *customsCost) Delete(ctx context.Context, customsCostIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", customsCostIds, &reply)
}