Files
service/erp/payable.go
kanade 1de63966ed feat(erp): 添加排序功能支持
- 定义 OrderItem、OrderField 和 OrderSort 类型及常量
- 为费用模块添加 createdAt、amount 排序字段
- 为应付模块添加 createdAt、amount 排序字段
- 为收汇模块添加 createdAt、entryAmount、receivableFxAmount 排序字段
- 为应收模块添加 createdAt、receivedAmount、receivableAmount、outstandingAmount 排序字段
- 为申请模块添加 createdAt、prepaidAmount、amount、paidAmount、payAt 排序字段
- 在各列表参数结构体中添加 Order 字段支持
2026-03-09 10:00:15 +08:00

136 lines
4.8 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 payable struct {
}
type ArgsPayableList struct {
Page bean.Page
Search PayableSearch
Order []OrderItem
}
type PayableSearch struct {
PayableSerial string // 付款单据号
FactoryId int64 // 工厂id
AccountingSerial string // 做账单号
CreatedAtStart *time.Time // 创建开始时间
CreatedAtEnd *time.Time // 创建结束时间
IsConfirm int64 // 是否确认
PermissionStaffIds []int64 // 权限员工id
}
type ReplyPayableList struct {
List []PayableItem `json:"list"`
Total int64 `json:"total"`
}
type PayableItem struct {
Id int64 `json:"id"`
PayableSerial string `json:"payableSerial"`
InvoiceSerial string `json:"invoiceSerial"`
AccountingSerial string `json:"accountingSerial"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
CurrencySymbol string `json:"currencySymbol"`
IsConfirm int64 `json:"isConfirm"`
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 *payable) List(ctx context.Context, args ArgsPayableList) (reply ReplyPayableList, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ReplyPayableInfo struct {
Id int64 `json:"id"`
PayableSerial string `json:"payableSerial"`
AccountingSerial string `json:"accountingSerial"`
InvoiceSerial string `json:"invoiceSerial"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
CurrencySymbol string `json:"currencySymbol"`
PurchaseStaffId int64 `json:"purchaseStaffId"`
IsConfirm int64 `json:"isConfirm"`
Ik3cloudStatus int64 `json:"ik3CloudStatus"`
Ik3cloudErrMsg string `json:"ik3CloudErrMsg"`
Ik3cloudUpdatedAt *time.Time `json:"ik3CloudUpdatedAt"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Products []PayableProductItem `json:"products"`
Costs []PayableCostItem `json:"costs"`
}
type PayableProductItem struct {
Id int64 `json:"id"`
AccountingProductId int64 `json:"accountingProductId"`
PiSerial string `json:"piSerial"`
FactoryName string `json:"factoryName"`
Name string `json:"name"`
Serial string `json:"serial"`
PayableCount decimal.Decimal `json:"payableCount"`
InvoiceUnit string `json:"invoiceUnit"`
AddTaxRate decimal.Decimal `json:"addTaxRate"`
UnitPrice decimal.Decimal `json:"unitPrice"`
ExTaxUnitPrice decimal.Decimal `json:"exTaxUnitPrice"`
UnitAmount decimal.Decimal `json:"unitAmount"`
ExTaxUnitAmount decimal.Decimal `json:"exTaxUnitAmount"`
TaxAmount decimal.Decimal `json:"taxAmount"`
}
type PayableCostItem struct {
Id int64 `json:"id"`
FactoryName string `json:"factoryName"`
Name string `json:"name"`
Amount decimal.Decimal `json:"amount"`
Remarks string `json:"remarks"`
}
// Info @TITLE 详情
func (p *payable) Info(ctx context.Context, payableId int64) (reply ReplyPayableInfo, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", payableId, &reply)
return
}
// Confirm @TITLE 确认
func (p *payable) Confirm(ctx context.Context, payableId int64) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Confirm", payableId, &reply)
}
// Ik3cloud @TITLE 金蝶同步
func (p *payable) Ik3cloud(ctx context.Context, payableId int64) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Ik3cloud", payableId, &reply)
}