feat(erp): 添加应付模块功能

- 新增应付模块,支持应付列表和详情接口
- 添加应付单据的保存功能
- 实现与客户端的通信调用逻辑
- 定义应付相关的数据结构和参数类型
- 支持分页查询和搜索条件过滤
This commit is contained in:
2025-12-09 13:11:14 +08:00
parent 89999b7df3
commit 8614837410
8 changed files with 173 additions and 30 deletions

105
erp/payable.go Normal file
View File

@@ -0,0 +1,105 @@
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
}
type PayableSearch struct {
PayableSerial string // 付款单据号
FactoryId int64 // 工厂id
AccountingSerial string // 做账单号
CreatedAtStart *time.Time // 创建开始时间
CreatedAtEnd *time.Time // 创建结束时间
IsConfirm int64 // 是否确认
}
type ReplyPayableList struct {
List []PayableItem `json:"list"`
Total int64 `json:"total"`
}
type PayableItem struct {
Id int64 `json:"id"`
PayableSerial string `json:"payableSerial"`
FactoryName string `json:"factoryName"`
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"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 列表
func (p *payable) List(ctx context.Context, args ArgsPayableList) (reply ReplyPayableList, total int64) {
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"`
FactoryName string `json:"factoryName"`
FactoryBank string `json:"factoryBank"`
FactoryBankAccount string `json:"factoryBankAccount"`
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"`
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"`
Name string `json:"name"`
Serial string `json:"serial"`
PayableCount int64 `json:"payableCount"`
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"`
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, "List", payableId, &reply)
return
}