2024-08-13 16:06:41 +08:00
|
|
|
|
package erp
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"git.kumo.work/shama/service/client"
|
|
|
|
|
shipment2 "git.kumo.work/shama/service/erp/shipment"
|
|
|
|
|
"git.kumo.work/shama/service/lib/bean"
|
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type shipment struct {
|
|
|
|
|
shipment2.Shipment
|
|
|
|
|
}
|
|
|
|
|
type ArgsShipmentList struct {
|
|
|
|
|
Page bean.Page
|
|
|
|
|
Search ShipmentSearch
|
|
|
|
|
}
|
|
|
|
|
type ShipmentSearch struct {
|
2024-09-26 16:58:48 +08:00
|
|
|
|
InvoiceSerial string // 出运发票号
|
|
|
|
|
CustomIds []int64 // 客户筛选
|
|
|
|
|
StaffIds []int64 // 业务员筛选
|
|
|
|
|
WorkflowStatus []int64 // 审核状态
|
|
|
|
|
IsSerial int64 // 是否商检
|
|
|
|
|
IsCustoms int64 // 是否报关
|
|
|
|
|
IsExchangeSettlement int64 // 是否结汇
|
2024-08-13 16:06:41 +08:00
|
|
|
|
}
|
|
|
|
|
type ReplyShipmentList struct {
|
|
|
|
|
List []ShipmentItem `json:"list"`
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
}
|
|
|
|
|
type ShipmentItem struct {
|
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
|
PiSerials string `json:"piSerials"`
|
|
|
|
|
InvoiceSerial string `json:"invoiceSerial"`
|
|
|
|
|
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-09-26 16:58:48 +08:00
|
|
|
|
WorkflowStatus int64 `json:"workflowStatus"`
|
2024-08-13 16:06:41 +08:00
|
|
|
|
CreatedStaffId int64 `json:"createdStaffId"`
|
|
|
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
|
|
|
UpdatedAt *time.Time `json:"updatedAt"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// List @TITLE 列表
|
|
|
|
|
func (s *shipment) List(ctx context.Context, args ArgsShipmentList) (reply ReplyShipmentList, err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
err = xClient.Call(ctx, "List", args, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArgsShipmentAdd struct {
|
|
|
|
|
StaffId int64 // 员工id
|
|
|
|
|
ShipmentAdd ShipmentAdd
|
|
|
|
|
}
|
|
|
|
|
type ShipmentAdd struct {
|
2024-09-26 16:58:48 +08:00
|
|
|
|
CustomId int64 // 客户id
|
|
|
|
|
VouchingClerkId int64 // 单证id
|
2024-08-13 16:06:41 +08:00
|
|
|
|
EstSailingDate *time.Time // 预计船期
|
|
|
|
|
InvoiceSerial string // 发票号
|
|
|
|
|
InvoiceDate time.Time // 发票日期
|
|
|
|
|
ContractDate *time.Time // 合同日期
|
|
|
|
|
TradeType string // 贸易类型
|
|
|
|
|
OurCompany string // 我方公司
|
|
|
|
|
PaymentType string // 付款方式
|
|
|
|
|
PaymentDepositRate *decimal.Decimal // 付款定金比例
|
|
|
|
|
PaymentDepositAmount *decimal.Decimal // 定价金额
|
|
|
|
|
PaymentCycle *int64 // 付款周期
|
|
|
|
|
PaymentTerms string // 条款
|
|
|
|
|
CommissionRate *decimal.Decimal // 佣金比例
|
|
|
|
|
TradeCountry string // 贸易国别
|
|
|
|
|
RecBank string // 收汇银行
|
|
|
|
|
RecBankEng string // 收汇银行英文
|
|
|
|
|
RecBankName string // 收汇银行名称
|
|
|
|
|
RecBankNameEng string // 收汇银行名称英文
|
|
|
|
|
RecBankCardNo string // 收汇银行卡号
|
|
|
|
|
RecBankCardName string // 收汇银行户名
|
|
|
|
|
Shipper string // 托运人
|
|
|
|
|
Consignee string // 收货人
|
|
|
|
|
Notifier string // 通知人
|
|
|
|
|
ShipMode string // 运输方式
|
|
|
|
|
ContainerType string // 货柜类型
|
|
|
|
|
ReadyDate *time.Time // 货好时间
|
|
|
|
|
ShipPort string // 出运口岸
|
|
|
|
|
DischargePort string // 卸货港
|
|
|
|
|
DischargePortEng string // 卸货港英文
|
|
|
|
|
DeliveryCountry string // 运抵国
|
|
|
|
|
DeliveryCountryEng string // 运抵国英文
|
|
|
|
|
Destination string // 目的地
|
|
|
|
|
FactoryHaulAdress string // 工厂拖柜地址
|
2024-09-03 17:47:24 +08:00
|
|
|
|
LogisticsCompanyId int64 // 物流公司id
|
2024-08-13 16:06:41 +08:00
|
|
|
|
LogisticsCompany string // 物流公司
|
|
|
|
|
LogisticsCompanyContactName string // 物流公司联系人
|
|
|
|
|
LogisticsCompanyContactPhone string // 物流公司手机号
|
|
|
|
|
LogisticsCompanyContactTel string // 物流公司固定电话
|
|
|
|
|
LogisticsCompanyContactEmail string // 物流公司邮箱
|
|
|
|
|
SeparableFlag int64 // 可分批标记(1=可分 2=不可分)
|
|
|
|
|
CopyCount *int64 // 提单份数
|
|
|
|
|
InsuranceRatio *int64 // 保险比率
|
|
|
|
|
CreditSerial string // 信用证号
|
|
|
|
|
CreditDate *time.Time // 开证日期
|
|
|
|
|
InlandShipWay string // 内陆运输
|
|
|
|
|
PackagingType string // 包装种类
|
|
|
|
|
ShipmentNo string // shipmentNO
|
|
|
|
|
CnoSno string // CONTAINER NO./SEAL NO.
|
|
|
|
|
Declare1 string // 声明1
|
|
|
|
|
Declare2 string // 声明2
|
|
|
|
|
Info string // 备注
|
|
|
|
|
RegulatoryMethods string // 监管方式
|
|
|
|
|
TaxExemptionNature string // 征免性质
|
|
|
|
|
MarkText string // 唛头文字
|
|
|
|
|
MarkImg string // 唛头图片
|
|
|
|
|
SaleIds []int64 // 销售合同
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add @TITLE 添加
|
2024-08-26 16:46:45 +08:00
|
|
|
|
func (s *shipment) Add(ctx context.Context, args ArgsShipmentAdd) (shipmentId int64, err error) {
|
2024-08-13 16:06:41 +08:00
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-08-26 16:46:45 +08:00
|
|
|
|
err = xClient.Call(ctx, "Add", args, &shipmentId)
|
2024-08-13 16:06:41 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Info @TITLE 详情
|
2024-09-26 16:58:48 +08:00
|
|
|
|
func (s *shipment) Info(ctx context.Context, shipmentId int64) (reply shipment2.ReplyShipmentInfo, err error) {
|
2024-08-13 16:06:41 +08:00
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
err = xClient.Call(ctx, "Info", shipmentId, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArgsShipmentEdit struct {
|
|
|
|
|
ShipmentId int64 // 订舱单id
|
|
|
|
|
ArgsShipmentData
|
|
|
|
|
}
|
|
|
|
|
type ArgsShipmentData struct {
|
|
|
|
|
EstSailingDate *time.Time // 预计发运日期
|
|
|
|
|
InvoiceSerial string // 发票编号
|
|
|
|
|
InvoiceDate *time.Time // 发票日期
|
|
|
|
|
ContractDate *time.Time // 合同日期
|
|
|
|
|
TradeType string // 贸易类型
|
|
|
|
|
OurCompany string // 我方公司
|
|
|
|
|
RecBank string // 收款银行
|
|
|
|
|
RecBankEng string // 收款银行英文
|
|
|
|
|
RecBankName string // 收款银行名称
|
|
|
|
|
RecBankNameEng string // 收款银行名称英文
|
|
|
|
|
RecBankCardNo string // 收款银行卡号
|
|
|
|
|
RecBankCardName string // 收款银行卡名
|
|
|
|
|
PaymentTerms string // 付款条件
|
|
|
|
|
TradeCountry string // 贸易国
|
|
|
|
|
PaymentType string // 付款方式
|
|
|
|
|
PaymentDepositRate decimal.Decimal // 定金比例
|
|
|
|
|
PaymentCycle int64 // 付款周期
|
|
|
|
|
CommissionRate decimal.Decimal // 佣金比例
|
|
|
|
|
DueRecDate *time.Time // 预计收汇日期日期
|
|
|
|
|
Shipper string // 发货方
|
|
|
|
|
Consignee string // 收货方
|
|
|
|
|
Notifier string // 通知方
|
|
|
|
|
ShipMode string // 运输方式
|
|
|
|
|
ContainerType string // 柜型
|
|
|
|
|
ReadyDate *time.Time // 预计发运日期
|
|
|
|
|
ShipPort string // 港口
|
|
|
|
|
DischargePort string // 卸货港口
|
|
|
|
|
DischargePortEng string // 卸货港口英文
|
|
|
|
|
DeliveryCountry string // 运抵国
|
|
|
|
|
DeliveryCountryEng string // 运抵国英文
|
|
|
|
|
Destination string // 目的地
|
|
|
|
|
FactoryHaulAdress string // 工厂拖柜地址
|
|
|
|
|
SeparableFlag int64 // 可分批标记(1=可分 2=不可分)
|
2024-09-03 17:47:24 +08:00
|
|
|
|
LogisticsCompanyId int64 // 物流公司id
|
2024-08-13 16:06:41 +08:00
|
|
|
|
LogisticsCompany string // 物流公司
|
|
|
|
|
LogisticsCompanyContactName string // 物流公司联系人
|
|
|
|
|
LogisticsCompanyContactPhone string // 物流公司联系人电话
|
|
|
|
|
LogisticsCompanyContactTel string // 物流公司联系人固定电话
|
|
|
|
|
LogisticsCompanyContactEmail string // 物流公司联系人邮箱
|
|
|
|
|
CopyCount int64 // 提单份数
|
|
|
|
|
InsuranceRatio int64 // 保险比率
|
|
|
|
|
CreditSerial string // 信用证号
|
|
|
|
|
CreditDate *time.Time // 开证日期
|
|
|
|
|
InlandShipWay string // 内陆运输
|
|
|
|
|
PackagingType string // 包装种类
|
|
|
|
|
ShipmentNo string // shipmentNO
|
|
|
|
|
CnoSno string // CONTAINER NO./SEAL NO.
|
|
|
|
|
Declare1 string // 声明1
|
|
|
|
|
Declare2 string // 声明2
|
|
|
|
|
Info string // 备注
|
|
|
|
|
RegulatoryMethods string // 监管方式
|
|
|
|
|
TaxExemptionNature string // 征免性质
|
|
|
|
|
MarkText string // 唛头文字
|
|
|
|
|
MarkImg string // 唛头图片
|
2024-09-26 16:58:48 +08:00
|
|
|
|
VouchingClerkId int64 // 单证id
|
2024-08-13 16:06:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Edit @TITLE 编辑
|
|
|
|
|
func (s *shipment) Edit(ctx context.Context, args ArgsShipmentEdit) (err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
reply := 0
|
|
|
|
|
err = xClient.Call(ctx, "Edit", args, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-09-23 16:04:00 +08:00
|
|
|
|
|
|
|
|
|
type ReplyCustoms struct {
|
|
|
|
|
CostAmount decimal.Decimal `json:"costAmount"`
|
|
|
|
|
CustomsCostAmount decimal.Decimal `json:"customsCostAmount"`
|
|
|
|
|
SaleTotalAmount decimal.Decimal `json:"saleTotalAmount"`
|
|
|
|
|
Products []CustomsProductItem `json:"products"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CustomsProductItem struct {
|
|
|
|
|
Index int `json:"index"`
|
|
|
|
|
Serial string `json:"serial"`
|
|
|
|
|
CustomsName string `json:"customsName"`
|
|
|
|
|
ShipmentCount int64 `json:"shipmentCount"`
|
|
|
|
|
SalePrice decimal.Decimal `json:"salePrice"`
|
|
|
|
|
SaleAmount decimal.Decimal `json:"saleAmount"`
|
|
|
|
|
CustomsPrice decimal.Decimal `json:"customsPrice"`
|
|
|
|
|
CustomsAmount decimal.Decimal `json:"customsAmount"`
|
|
|
|
|
AdjustAmount decimal.Decimal `json:"adjustAmount"`
|
|
|
|
|
RealCustomsPrice decimal.Decimal `json:"realCustomsPrice"`
|
|
|
|
|
RealCustomsAmount decimal.Decimal `json:"realCustomsAmount"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Customs @TITLE 报关信息
|
|
|
|
|
func (s *shipment) Customs(ctx context.Context, shipmentId int64) (reply ReplyCustoms, err error) {
|
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
err = xClient.Call(ctx, "Customs", shipmentId, &reply)
|
|
|
|
|
return
|
|
|
|
|
}
|