Files
service/erp/paymentRefund.go
kanade 7406f37764 feat(paymentRefund): 新增取消付款退款单方法
- 添加 Cancel 方法用于取消付款退款单
- 通过远程客户端调用 Cancel 接口实现取消逻辑
2026-10-20 15:07:27 +08:00

164 lines
5.2 KiB
Go

package erp
import (
"context"
"time"
"git.kumo.work/shama/service/client"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
)
type paymentRefund struct {
}
type ArgsPaymentRefundList struct {
Page bean.Page
Search PaymentRefundSearch
}
type PaymentRefundSearch struct {
PaymentRefundIds []int64 // 付款退款单id
PaymentRefundSerial string // 付款退款单号
FactoryId int64 // 工厂
FactoryName string // 工厂名称
CreatedAtStart *time.Time // 创建开始时间
CreatedAtEnd *time.Time // 创建结束时间
}
type ReplyPaymentRefundList struct {
Total int64 `json:"total"`
List []PaymentRefundItem `json:"list"`
}
type PaymentRefundItem struct {
Id int64 `json:"id"`
PaymentRefundSerial string `json:"paymentRefundSerial"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
RefundDate time.Time `json:"refundDate"`
BankAccount string `json:"bankAccount"`
InvoiceSerial string `json:"invoiceSerial"`
PaymentPurposeNumber string `json:"paymentPurposeNumber"`
PaymentPurpose string `json:"paymentPurpose"`
Remark string `json:"remark"`
Ik3cloudStatus int64 `json:"ik3CloudStatus"`
Ik3cloudErrMsg string `json:"ik3CloudErrMsg"`
Ik3cloudUpdatedAt *time.Time `json:"ik3CloudUpdatedAt"`
CreatedStaffId int64 `json:"createdStaffId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
type PaymentRefundCostItem struct {
Id int64 `json:"id"`
PaymentPurpose string `json:"paymentPurpose"`
Amount decimal.Decimal `json:"amount"`
BankAccount string `json:"bankAccount"`
InvoiceSerial string `json:"invoiceSerial"`
}
// List @TITLE 列表
func (p *paymentRefund) List(ctx context.Context, args ArgsPaymentRefundList) (reply ReplyPaymentRefundList, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsPaymentRefundAdd struct {
StaffId int64
PaymentRefundAdd
}
type PaymentRefundAdd struct {
FactoryId int64 // 工厂id
Currency string // 币种
CurrencyName string // 币种名称
CurrencySymbol string // 币种符号
CurrencyRate decimal.Decimal // 币种汇率
RefundDate time.Time // 退款日期
Amount decimal.Decimal // 金额
Remark string // 备注
PaymentPurposeNumber string // 原付款用途
PaymentPurpose string // 原付款用途
BankAccount string // 我方银行账号
InvoiceSerial string // 发票号
}
// Add @TITLE 添加(手动创建)
func (p *paymentRefund) Add(ctx context.Context, args ArgsPaymentRefundAdd) (paymentRefundId int64, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &paymentRefundId)
return
}
type ArgsPaymentRefundGen struct {
StaffId int64 // 员工id
ReceiptId int64 // 收汇单id
FactoryId int64 // 工厂id
InvoiceSerial string // 发票号
PaymentPurposeNumber string // 原付款用途编码
PaymentPurpose string // 原付款用途
}
// Gen @TITLE 生成
func (p *paymentRefund) Gen(ctx context.Context, args ArgsPaymentRefundGen) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Gen", args, &reply)
}
// Info @TITLE 详情
func (p *paymentRefund) Info(ctx context.Context, paymentRefundId int64) (reply PaymentRefundItem, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", paymentRefundId, &reply)
return
}
type ArgsPaymentRefundEdit struct {
PaymentRefundId int64 // 付款退款单id
PaymentRefundAdd
}
// Edit @TITLE 编辑
func (p *paymentRefund) Edit(ctx context.Context, args ArgsPaymentRefundEdit) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Cancel @TITLE 取消付款退款单
func (p *paymentRefund) Cancel(ctx context.Context, paymentRefundId int64) error {
xClient, err := client.GetClient(p)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Cancel", paymentRefundId, &reply)
}
// Ik3cloud @TITLE 金蝶同步
func (p *paymentRefund) Ik3cloud(ctx context.Context, paymentRefundId int64) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Ik3cloud", paymentRefundId, &reply)
}