- 在查询参数结构体中添加 IsConfirm 字段,支持按确认状态筛选 - 在数据模型结构体中添加 IsConfirm 字段并配置 json 标签 - 新增 Confirm 方法,调用远程接口确认付款退款单 - 新增 CancelConfirm 方法,调用远程接口取消确认付款退款单
187 lines
5.9 KiB
Go
187 lines
5.9 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 // 工厂名称
|
|
IsConfirm int64 // 确认状态 1=已确认 2=未确认
|
|
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"`
|
|
PayCompany string `json:"payCompany"`
|
|
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"`
|
|
IsConfirm int64 `json:"isConfirm"`
|
|
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)
|
|
}
|
|
|
|
// Confirm @TITLE 确认付款退款单
|
|
func (p *paymentRefund) Confirm(ctx context.Context, paymentRefundId int64) (err error) {
|
|
xClient, err := client.GetClient(p)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Confirm", paymentRefundId, &reply)
|
|
}
|
|
|
|
// CancelConfirm @TITLE 取消确认付款退款单
|
|
func (p *paymentRefund) CancelConfirm(ctx context.Context, paymentRefundId int64) (err error) {
|
|
xClient, err := client.GetClient(p)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "CancelConfirm", 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)
|
|
}
|