Files
service/erp/receipt.go
kanade 3c1fa079cf feat(receipt): 添加客户编号字段
- 在 Receipt 结构体中新增 CustomNumber 字段
- 用于存储客户的唯一标识信息
- 支持后续按客户编号查询和统计功能
2025-12-19 16:58:39 +08:00

153 lines
4.7 KiB
Go

package erp
import (
"context"
"time"
"git.kumo.work/shama/service/client"
receipt2 "git.kumo.work/shama/service/erp/receipt"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
)
type receipt struct {
receipt2.Receipt
}
type ArgsReceiptList struct {
Page bean.Page
Search ReceiptSearch
}
type ReceiptSearch struct {
ReceiptSerial string // 收汇单号
CustomId int64 // 客户筛选
CustomName string // 客户筛选
BankName string // 结汇银行
ReceiptDateStart *time.Time // 创建开始时间
ReceiptDateEnd *time.Time // 创建结束时间
}
type ReplyReceiptList struct {
List []ReceiptItem `json:"list"`
Total int64 `json:"total"`
}
type ReceiptItem struct {
Id int64 `json:"id"`
ReceiptSerial string `json:"receiptSerial"`
CustomId int64 `json:"customId"`
CustomName string `json:"customName"`
ReceiptDate time.Time `json:"receiptDate"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
BankName string `json:"bankName"`
EntryAmount decimal.Decimal `json:"entryAmount"`
ReceivableFxAmount decimal.Decimal `json:"receivableFxAmount"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 列表
func (r *receipt) List(ctx context.Context, args ArgsReceiptList) (reply ReplyReceiptList, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsReceiptAdd struct {
StaffId int64
ReceiptAdd
}
type ReceiptAdd struct {
ReceiptDate time.Time // 收汇日期
Currency string // 币种
CurrencyName string // 币种名称
CurrencySymbol string // 币种符号
CurrencyRate decimal.Decimal // 币种汇率
CustomId int64 // 客户id
BankName string // 结汇银行
EntryAmount decimal.Decimal // 外币入账金额
ForeignFee decimal.Decimal // 国外扣费
DomesticFee decimal.Decimal // 国内扣费
DomesticFeeType DomesticFeeType // 国内扣费类型 1=外币 2=人民币
}
// Add @TITLE 添加
func (r *receipt) Add(ctx context.Context, args ArgsReceiptAdd) (receiptId int64, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &receiptId)
return
}
type ReplyReceiptInfo struct {
Id int64 `json:"id"`
ReceiptSerial string `json:"receiptSerial"`
ReceiptDate time.Time `json:"receiptDate"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
CustomId int64 `json:"customId"`
CustomName string `json:"customName"`
BankName string `json:"bankName"`
EntryAmount decimal.Decimal `json:"entryAmount"`
ForeignFee decimal.Decimal `json:"foreignFee"`
DomesticFee decimal.Decimal `json:"domesticFee"`
DomesticFeeType int64 `json:"domesticFeeType"`
ReceivableFxAmount decimal.Decimal `json:"receivableFxAmount"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 详情
func (r *receipt) Info(ctx context.Context, receiptId int64) (reply ReplyReceiptInfo, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", receiptId, &reply)
return
}
type ArgsReceiptEdit struct {
ReceiptId int64
ReceiptAdd
}
// Edit @TITLE 编辑
func (r *receipt) Edit(ctx context.Context, args ArgsReceiptEdit) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Ik3cloud @TITLE 金蝶同步
func (r *receipt) Ik3cloud(ctx context.Context, receiptId int64) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Ik3cloud", receiptId, &reply)
}
// Cancel @TITLE 作废
func (r *receipt) Cancel(ctx context.Context, receiptId int64) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Cancel", receiptId, &reply)
}