From 78393b37d5ab095a699f0a7d43a1708df06ff6d1 Mon Sep 17 00:00:00 2001 From: kanade Date: Tue, 9 Dec 2025 14:09:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(erp):=20=E6=96=B0=E5=A2=9E=E6=94=B6?= =?UTF-8?q?=E6=AC=BE=E7=AE=A1=E7=90=86=E6=9C=8D=E5=8A=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增收款单列表查询接口 - 新增收款单详情查询接口 - 定义收款单相关数据结构 - 实现与ERP客户端通信逻辑 - 添加分页和搜索参数支持 - 集成decimal库处理金额计算 --- erp/receivable.go | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 erp/receivable.go diff --git a/erp/receivable.go b/erp/receivable.go new file mode 100644 index 0000000..a76d429 --- /dev/null +++ b/erp/receivable.go @@ -0,0 +1,96 @@ +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 (p *receivable) List(ctx context.Context, args ArgsReceivableList) (reply ReplyReceivableList, err error) { + xClient, err := client.GetClient(p) + 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 (p *receivable) Info(ctx context.Context, receivableId int64) (reply ReplyReceivableInfo, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "List", receivableId, &reply) + return +}