2024-09-26 16:58:48 +08:00
|
|
|
package shipment
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"git.kumo.work/shama/service/client"
|
2024-10-11 11:12:44 +08:00
|
|
|
bean2 "git.kumo.work/shama/service/erp/bean"
|
2024-09-26 16:58:48 +08:00
|
|
|
"git.kumo.work/shama/service/lib/bean"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type customs struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsCustomsList struct {
|
|
|
|
Page bean.Page
|
|
|
|
Search CustomsSearch
|
|
|
|
}
|
|
|
|
type CustomsSearch struct {
|
|
|
|
CustomsNo string // 报关单号
|
|
|
|
InvoiceSerial string // 出运发票号
|
|
|
|
CustomIds []int64 // 客户筛选
|
|
|
|
StaffIds []int64 // 业务员筛选
|
2024-10-23 11:56:33 +08:00
|
|
|
BanFlag int64 // 是否有效
|
2024-10-12 14:46:31 +08:00
|
|
|
CustomsIds []int64 // 报关id
|
2024-09-26 16:58:48 +08:00
|
|
|
}
|
|
|
|
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"`
|
2024-10-23 11:56:33 +08:00
|
|
|
BanFlag int64 `json:"banFlag"`
|
2024-09-26 16:58:48 +08:00
|
|
|
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"`
|
2024-10-23 11:56:33 +08:00
|
|
|
BanFlag int64 `json:"banFlag"`
|
2024-09-26 16:58:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
|
|
|
// Products @TITLE 获取产品
|
|
|
|
func (c *customs) Products(ctx context.Context, customsId int64) (reply []SaleProductItem, err error) {
|
|
|
|
xClient, err := client.GetClient(c)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Products", customsId, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-10-11 11:12:44 +08:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2024-09-26 16:58:48 +08:00
|
|
|
type ArgsCustomsGen struct {
|
|
|
|
ShipmentId int64 // 订舱id
|
|
|
|
CustomsNo string // 报关单号
|
|
|
|
ShipmentSaleProductIds []int64 // 订舱产品id
|
2024-10-11 11:12:44 +08:00
|
|
|
ShipmentGiftIds []int64 // 订舱赠品id
|
2024-09-26 16:58:48 +08:00
|
|
|
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
|
|
|
|
}
|
2024-10-11 11:12:44 +08:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|