Files
service/erp/shipment/customs.go
kanade 0e10dab1af feat(shipment): 更新报关产品接口功能
- 添加 ReplyCustomsProductItem 结构体,扩展 SaleProductItem 并增加报关产品字段
- 修改 Products 方法返回类型为 ReplyCustomsProductItem 切片
- 新增 ArgsCustomsProductsEdit 和 CustomsProduct 结构体用于产品编辑
- 添加 ProductsEdit 方法支持报关产品的批量编辑功能
- 在 ProductsEdit 中增加海关单位、海关数量等字段映射
2026-09-21 16:13:10 +08:00

187 lines
4.9 KiB
Go

package shipment
import (
"context"
"time"
"git.kumo.work/shama/service/client"
bean2 "git.kumo.work/shama/service/erp/bean"
"git.kumo.work/shama/service/lib/bean"
)
type customs struct {
}
type ArgsCustomsList struct {
Page bean.Page
Search CustomsSearch
}
type CustomsSearch struct {
CustomsNo string // 报关单号
InvoiceSerial string // 出运发票号
CustomIds []int64 // 客户筛选
StaffIds []int64 // 业务员筛选
BanFlag int64 // 是否有效
CustomsIds []int64 // 报关id
EstSailingDateStart *time.Time // 预计船期
EstSailingDateEnd *time.Time // 预计船期
}
type ReplyCustomsList struct {
List []CustomsItem `json:"list"`
Total int64 `json:"total"`
}
type CustomsItem struct {
Id int64 `json:"id"`
ShipmentId int64 `json:"shipmentId"`
InvoiceSerial string `json:"invoiceSerial"`
CustomsNo string `json:"customsNo"`
ContractDate *time.Time `json:"contractDate"`
InvoiceDate *time.Time `json:"invoiceDate"`
CustomName string `json:"customName"`
CustomShortName string `json:"customShortName"`
EstSailingDate *time.Time `json:"estSailingDate"`
ShipPort string `json:"shipPort"`
DischargePort string `json:"dischargePort"`
DischargePortEng string `json:"dischargePortEng"`
BanFlag int64 `json:"banFlag"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 列表
func (c *customs) List(ctx context.Context, args ArgsCustomsList) (reply ReplyCustomsList, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ReplyCustomsInfo struct {
ReplyShipmentInfo
CustomsNo string `json:"customsNo"`
ShipmentId int64 `json:"shipmentId"`
BanFlag int64 `json:"banFlag"`
}
// Info @TITLE 详情
func (c *customs) Info(ctx context.Context, customsId int64) (reply ReplyCustomsInfo, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", customsId, &reply)
return
}
type ReplyCustomsProductItem struct {
SaleProductItem
CustomsProductId int64 `json:"customsProductId"`
HsUnit string `json:"hsUnit"`
HsNum *int64 `json:"hsNum"`
}
// Products @TITLE 获取产品
func (c *customs) Products(ctx context.Context, customsId int64) (reply []ReplyCustomsProductItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Products", customsId, &reply)
return
}
type ArgsCustomsProductsEdit struct {
CustomsId int64
Products []CustomsProduct
}
type CustomsProduct struct {
CustomsProductId int64 // 报关产品id
HsUnit string // 海关单位
HsNum *int64 // 海关数量
}
// ProductsEdit @TITLE 产品编辑
func (c *customs) ProductsEdit(ctx context.Context, args ArgsCustomsProductsEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "ProductsEdit", args, &reply)
return
}
// Gifts @TITLE 获取赠品
func (c *customs) Gifts(ctx context.Context, customsId int64) (reply []GiftItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Gifts", customsId, &reply)
return
}
type ArgsCustomsGen struct {
ShipmentId int64 // 订舱id
CustomsNo string // 报关单号
ShipmentSaleProductIds []int64 // 订舱产品id
ShipmentGiftIds []int64 // 订舱赠品id
StaffId int64 // 操作员工
}
// Gen @TITLE 生成
func (c *customs) Gen(ctx context.Context, args ArgsCustomsGen) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Gen", args, &reply)
return
}
// Cancel @TITLE 作废
func (c *customs) Cancel(ctx context.Context, customsId int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Cancel", customsId, &reply)
return
}
// Customs @TITLE 报关信息
func (c *customs) Customs(ctx context.Context, customsId int64) (reply bean2.ReplyCustoms, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Customs", customsId, &reply)
return
}
type ArgsCustomsEdit struct {
CustomsId int64 // 报关单id
ArgsCustomsData
}
type ArgsCustomsData struct {
InvoiceDate *time.Time // 发票日期
ContractDate *time.Time // 合同日期
}
// Edit @TITLE 编辑
func (c *customs) Edit(ctx context.Context, args ArgsCustomsEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Edit", args, &reply)
return
}