Files
service/erp/receipt.go
kanade e0f18fb837 feat(erp): 新增收汇管理模块及相关功能
- 新增收汇单据管理,支持列表、详情、新增、编辑功能
- 新增收汇认领管理,支持认领列表、新增、编辑、删除、确认及取消确认功能
- 新增国内扣费类型常量定义(外币、人民币)
- 优化服务发现逻辑,针对特定 basePath 使用本地调试地址
- 修复应收模块方法接收者命名问题,统一为 r *receivable
2025-12-11 11:04:32 +08:00

130 lines
4.1 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 // 收汇单号
PayName 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"`
PayName string `json:"payName"`
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 // 币种汇率
PayName string // 付款单位
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"`
PayName string `json:"payName"`
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)
}