Files
service/erp/receivable.go
kanade e0f18fb837 feat(erp): 新增收汇管理模块及相关功能
- 新增收汇单据管理,支持列表、详情、新增、编辑功能
- 新增收汇认领管理,支持认领列表、新增、编辑、删除、确认及取消确认功能
- 新增国内扣费类型常量定义(外币、人民币)
- 优化服务发现逻辑,针对特定 basePath 使用本地调试地址
- 修复应收模块方法接收者命名问题,统一为 r *receivable
2025-12-11 11:04:32 +08:00

97 lines
3.6 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 receivable struct {
}
type ArgsReceivableList struct {
Page bean.Page
Search ReceivableSearch
}
type ReceivableSearch struct {
ReceivableSerial string // 收款单据号
CustomId int64 // 客户id
InvoiceSerial string // 出运发票号
CreatedAtStart *time.Time // 创建开始时间
CreatedAtEnd *time.Time // 创建结束时间
}
type ReplyReceivableList struct {
List []ReceivableItem `json:"list"`
Total int64 `json:"total"`
}
type ReceivableItem struct {
Id int64 `json:"id"`
ReceivableSerial string `json:"receivableSerial"`
CustomName string `json:"customName"`
InvoiceSerial string `json:"invoiceSerial"`
ReceivableAmount decimal.Decimal `json:"receivableAmount"`
ReceivedAmount decimal.Decimal `json:"receivedAmount"`
OutstandingAmount decimal.Decimal `json:"outstandingAmount"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
CurrencySymbol string `json:"currencySymbol"`
CreatedStaffID int64 `json:"createdStaffID"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 列表
func (r *receivable) List(ctx context.Context, args ArgsReceivableList) (reply ReplyReceivableList, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ReplyReceivableInfo struct {
Id int64 `json:"id"`
ReceivableSerial string `json:"receivableSerial"`
CustomName string `json:"customName"`
InvoiceSerial string `json:"invoiceSerial"`
ReceivableAmount decimal.Decimal `json:"receivableAmount"`
ReceivedAmount decimal.Decimal `json:"receivedAmount"`
OutstandingAmount decimal.Decimal `json:"outstandingAmount"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
CurrencySymbol string `json:"currencySymbol"`
CreatedStaffID int64 `json:"createdStaffID"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
Products []ReceivableProductItem `json:"products"`
}
type ReceivableProductItem struct {
Id int64 `json:"id"`
ShipmentProductId int64 `json:"shipmentProductId"`
Name string `json:"name"`
Serial string `json:"serial"`
ReceivableCount int64 `json:"receivableCount"`
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"`
}
// Info @TITLE 详情
func (r *receivable) Info(ctx context.Context, receivableId int64) (reply ReplyReceivableInfo, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "List", receivableId, &reply)
return
}