- 实现付款单列表查询功能,支持分页和多条件搜索 - 添加付款单生成功能,根据应付单ID创建付款单 - 集成金蝶同步功能,支持付款单数据同步到金蝶系统 - 定义完整的付款单数据结构,包含金额、币种、采购人员等字段 - 实现付款单搜索功能,支持按付款单号、合同号、时间范围等条件查询 - 添加IK3Cloud状态管理,处理金蝶同步状态和错误信息
78 lines
2.2 KiB
Go
78 lines
2.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 payment struct {
|
|
}
|
|
type ArgsPaymentList struct {
|
|
Page bean.Page
|
|
Search PaymentSearch
|
|
}
|
|
type PaymentSearch struct {
|
|
PaymentSerial string // 付款单号
|
|
AccountingSerial string // 做账合同号
|
|
CreatedAtStart *time.Time
|
|
CreatedAtEnd *time.Time
|
|
PurchaseStaffIds []int64 // 采购人员
|
|
}
|
|
type ReplyPaymentList struct {
|
|
Total int64 `json:"total"`
|
|
List []PaymentItem `json:"list"`
|
|
}
|
|
type PaymentItem struct {
|
|
Id int64 `json:"id"`
|
|
PaymentSerial string `json:"paymentSerial"`
|
|
AccountingSerial string `json:"accountingSerial"`
|
|
PayableSerial string `json:"payableSerial"`
|
|
InvoiceSerial string `json:"invoiceSerial"`
|
|
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"`
|
|
PurchaseStaffId int64 `json:"purchaseStaffId"`
|
|
Ik3cloudStatus int64 `json:"ik3CloudStatus"`
|
|
Ik3cloudErrMsg string `json:"ik3CloudErrMsg"`
|
|
Ik3cloudUpdatedAt *time.Time `json:"ik3CloudUpdatedAt"`
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
UpdatedAt *time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// List @TITLE 列表
|
|
func (p *payment) List(ctx context.Context, args ArgsPaymentList) (reply ReplyPaymentList, err error) {
|
|
xClient, err := client.GetClient(p)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "List", args, &reply)
|
|
return
|
|
}
|
|
|
|
// Gen @TITLE 生成付款单
|
|
func (p *payment) Gen(ctx context.Context, payableId int64) (err error) {
|
|
xClient, err := client.GetClient(p)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Gen", payableId, &reply)
|
|
}
|
|
|
|
// Ik3cloud @TITLE 金蝶同步
|
|
func (p *payment) Ik3cloud(ctx context.Context, paymentId int64) (err error) {
|
|
xClient, err := client.GetClient(p)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Ik3cloud", paymentId, &reply)
|
|
}
|